first commit
This commit is contained in:
commit
fec7cb655b
88 files changed
+11607
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Member extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'unique_id', 'name', 'picture', 'gender', 'date_of_birth',
|
||||
'nationality', 'weight', 'height', 'contact_info', 'social_media',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'contact_info' => 'array',
|
||||
'social_media' => 'array',
|
||||
'date_of_birth' => 'date',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($member) {
|
||||
// Only generate if unique_id is not set
|
||||
if (empty($member->unique_id)) {
|
||||
$member->unique_id = Str::random(50);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user