first intial
This commit is contained in:
43
apps/backend/app/Models/Material.php
Normal file
43
apps/backend/app/Models/Material.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Material extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'category_id',
|
||||
'title',
|
||||
'author',
|
||||
'description',
|
||||
'cover_image_path',
|
||||
'file_path',
|
||||
'tags',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'tags' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the category that owns the material.
|
||||
*/
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user