Adds a Filament admin (Profile settings page plus CRUD resources for Education, Experience, Projects, and Posts) backing a public-facing personal site: hero/about/timeline home page, project showcase, and blog, styled with a dark editorial theme (Fraunces + Instrument Sans). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Support\Str;
|
|
|
|
class Project extends Model
|
|
{
|
|
protected $fillable = [
|
|
'title',
|
|
'slug',
|
|
'summary',
|
|
'description',
|
|
'image',
|
|
'url',
|
|
'repository_url',
|
|
'tech_stack',
|
|
'is_featured',
|
|
'sort_order',
|
|
];
|
|
|
|
protected $casts = [
|
|
'tech_stack' => 'array',
|
|
'is_featured' => 'boolean',
|
|
];
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::saving(function (Project $project) {
|
|
if (blank($project->slug)) {
|
|
$project->slug = Str::slug($project->title);
|
|
}
|
|
});
|
|
}
|
|
|
|
public function getRouteKeyName(): string
|
|
{
|
|
return 'slug';
|
|
}
|
|
|
|
protected function imageUrl(): Attribute
|
|
{
|
|
return Attribute::get(fn () => $this->image ? Storage::disk('public')->url($this->image) : null);
|
|
}
|
|
}
|