Refactor Filament resources and models; add attribute casting in Group model, update navigation icons, and remove TeacherSeeder in favor of UserTableSeeder.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
@@ -19,6 +20,21 @@ class Group extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
];
|
||||
|
||||
public function name(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => $this->start_date->format('d M') . ' - ' . $this->end_date->format('d M'),
|
||||
);
|
||||
}
|
||||
|
||||
public function pilgrims(): HasMany
|
||||
{
|
||||
return $this->hasMany(Pilgrim::class);
|
||||
|
||||
Reference in New Issue
Block a user