class Member extends Model{ protected $table = 'members'; protected $fillable = [ 'first_name', 'middle_name', 'last_name', 'country', 'institution', 'gender', 'orcid', 'profile_picture_url', 'organizing_member_role_id', 'sc_member_type_id', 'sc_member_since', 'sc_member_until', 'memberable_id', 'memberable_type', 'memberable_email', ]; public function setOrcidAttribute($value): void { // Remove any hyphens that might already be in the string $cleanedValue = str_replace('-', '', $value); // Insert hyphens at the correct positions $formattedValue = substr($cleanedValue, 0, 4) . '-' . substr($cleanedValue, 4, 4) . '-' . substr($cleanedValue, 8, 4) . '-' . substr($cleanedValue, 12, 4); $this->attributes['orcid'] = $formattedValue; }// public function getOrcidAttribute($value): string// {// return str_replace('-', '', $value);// }
public function getValidationRules(): array { return ['required', new OrcidChecksum]; }
public function hasMask(): bool { return true; }
public function getMask(): ?Mask { $mask = new Mask(); $mask->numeric() ->thousandsSeparator(',') ->decimalSeparator('.') ->decimalPlaces(2); return $this->evaluate($mask, [ 'mask' => app(TextInput\Mask::class), ]); }
Select::make('conference_series_id')
protected function getTableQuery(): Builder { return parent::getTableQuery()->with('sponsorType'); }
class ConferenceSponsor extends Pivot{ protected $table = 'conference_sponsor'; protected $fillable = [ 'conference_id', 'sponsor_id', 'sponsor_type_id', ]; public function conference() { return $this->belongsTo(Conference::class); } public function sponsor() { return $this->belongsTo(Sponsor::class); } public function sponsorType() { return $this->belongsTo(SponsorType::class); }}
class Sponsor extends Model{ protected $table = 'sponsors'; protected $fillable = [ 'name', 'country', 'logo_url', ]; public function conferences() { return $this->belongsToMany(Conference::class, 'conference_sponsor') ->using(ConferenceSponsor::class) ->withPivot('sponsor_type_id'); }}