Add Filament admin panel and creative public portfolio site
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>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Education extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'institution',
|
||||
'degree',
|
||||
'field_of_study',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'description',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Experience extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'company',
|
||||
'role',
|
||||
'location',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'is_current',
|
||||
'description',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
'is_current' => 'boolean',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Post extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'slug',
|
||||
'excerpt',
|
||||
'body',
|
||||
'cover_image',
|
||||
'tags',
|
||||
'published_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'tags' => 'array',
|
||||
'published_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saving(function (Post $post) {
|
||||
if (blank($post->slug)) {
|
||||
$post->slug = Str::slug($post->title);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function scopePublished(Builder $query): Builder
|
||||
{
|
||||
return $query->whereNotNull('published_at')->where('published_at', '<=', now());
|
||||
}
|
||||
|
||||
public function getRouteKeyName(): string
|
||||
{
|
||||
return 'slug';
|
||||
}
|
||||
|
||||
protected function coverImageUrl(): Attribute
|
||||
{
|
||||
return Attribute::get(fn () => $this->cover_image ? Storage::disk('public')->url($this->cover_image) : null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class Profile extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'headline',
|
||||
'bio',
|
||||
'location',
|
||||
'email',
|
||||
'avatar',
|
||||
'resume_path',
|
||||
'social_links',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'social_links' => 'array',
|
||||
];
|
||||
|
||||
protected function avatarUrl(): Attribute
|
||||
{
|
||||
return Attribute::get(fn () => $this->avatar ? Storage::disk('public')->url($this->avatar) : null);
|
||||
}
|
||||
|
||||
protected function resumeUrl(): Attribute
|
||||
{
|
||||
return Attribute::get(fn () => $this->resume_path ? Storage::disk('public')->url($this->resume_path) : null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -4,6 +4,8 @@ namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -12,11 +14,16 @@ use Illuminate\Notifications\Notifiable;
|
||||
|
||||
#[Fillable(['name', 'email', 'password'])]
|
||||
#[Hidden(['password', 'remember_token'])]
|
||||
class User extends Authenticatable
|
||||
class User extends Authenticatable implements FilamentUser
|
||||
{
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
public function canAccessPanel(Panel $panel): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user