lots of progress

This commit is contained in:
2025-04-12 17:18:33 +03:00
parent 8d230e8e67
commit 3d4260d57e
44 changed files with 2590 additions and 2883 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Str;
class GameList extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'name',
'slug',
'description',
'is_default'
];
protected static function boot()
{
parent::boot();
static::creating(function ($list) {
$list->slug = Str::slug($list->name);
});
static::updating(function ($list) {
$list->slug = Str::slug($list->name);
});
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function games(): BelongsToMany
{
return $this->belongsToMany(Game::class)->withTimestamps();
}
}