42 lines
757 B
PHP
42 lines
757 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Artwork extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'gallery_id',
|
|
'creator_id',
|
|
'title',
|
|
'description',
|
|
'image_url',
|
|
'medium',
|
|
'dimensions',
|
|
'creation_year',
|
|
'price',
|
|
'is_visible',
|
|
'is_for_sale',
|
|
];
|
|
|
|
/**
|
|
* Le créateur de l'oeuvre.
|
|
*/
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'creator_id');
|
|
}
|
|
|
|
/**
|
|
* La galerie à laquelle l'oeuvre appartient.
|
|
*/
|
|
public function gallery()
|
|
{
|
|
return $this->belongsTo(Gallery::class);
|
|
}
|
|
}
|