mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 07:11:09 -05:00
41 lines
753 B
PHP
41 lines
753 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\HasSlugHistory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
class Designer extends Model
|
|
{
|
|
use HasSlugHistory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'slug',
|
|
'description',
|
|
'website',
|
|
'founded_date',
|
|
'headquarters',
|
|
];
|
|
|
|
protected $casts = [
|
|
'founded_date' => 'date',
|
|
];
|
|
|
|
protected static function boot()
|
|
{
|
|
parent::boot();
|
|
|
|
static::creating(function ($designer) {
|
|
if (empty($designer->slug)) {
|
|
$designer->slug = Str::slug($designer->name);
|
|
}
|
|
});
|
|
}
|
|
|
|
public function rides()
|
|
{
|
|
return $this->hasMany(Ride::class);
|
|
}
|
|
} |