You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
763 B

  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Page extends Model
  6. {
  7. use HasFactory;
  8. /**
  9. * The attributes that are mass assignable.
  10. *
  11. * @var array
  12. */
  13. protected $fillable = [
  14. 'page_title',
  15. 'introduction',
  16. 'category_id',
  17. ];
  18. /**
  19. * Get the attributes that should be cast.
  20. *
  21. * @return array<string, string>
  22. */
  23. protected function casts(): array
  24. {
  25. return [
  26. 'category_id' => 'integer',
  27. ];
  28. }
  29. /**
  30. * Get the framework associated with the instruction.
  31. */
  32. public function category()
  33. {
  34. return $this->belongsTo(Category::class);
  35. }
  36. }