feat: implement Change resource with CRUD functionality and migration
update image tags to v0.0.8 in build scripts and docker-compose files
This commit is contained in:
parent
64a7d1d2f4
commit
5b0e55c4b2
20 changed files with 408 additions and 88 deletions
19
app/Models/Change.php
Normal file
19
app/Models/Change.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Change extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'note',
|
||||
'user_id',
|
||||
'type',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,11 +6,9 @@ namespace App\Models;
|
|||
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Container\Attributes\Log;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Log as FacadesLog;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
|
@ -18,7 +16,7 @@ use Laravel\Sanctum\HasApiTokens;
|
|||
class User extends Authenticatable implements FilamentUser
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable, TwoFactorAuthenticatable, HasApiTokens;
|
||||
use HasApiTokens, HasFactory, Notifiable, TwoFactorAuthenticatable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
|
@ -64,7 +62,7 @@ class User extends Authenticatable implements FilamentUser
|
|||
return Str::of($this->name)
|
||||
->explode(' ')
|
||||
->take(2)
|
||||
->map(fn($word) => Str::substr($word, 0, 1))
|
||||
->map(fn ($word) => Str::substr($word, 0, 1))
|
||||
->implode('');
|
||||
}
|
||||
|
||||
|
|
@ -75,4 +73,9 @@ class User extends Authenticatable implements FilamentUser
|
|||
{
|
||||
return $this->email === config('app.admin_email') || $this->role === 'admin';
|
||||
}
|
||||
|
||||
public function changes()
|
||||
{
|
||||
return $this->hasMany(Change::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue