Phase 4 work order profile depth
This commit is contained in:
@@ -9,11 +9,22 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
#[Fillable([
|
||||
'user_id', 'company_name', 'headline', 'description', 'service_categories',
|
||||
'hiring_regions', 'vendor_onboarding', 'payment_terms', 'website_url',
|
||||
'contact_email', 'public_contact',
|
||||
'hiring_regions', 'hiring_policies', 'locations', 'vendor_onboarding',
|
||||
'payment_terms', 'website_url', 'contact_email', 'public_contact',
|
||||
'profile_visibility', 'private_notes',
|
||||
])]
|
||||
class BuyerProfile extends Model
|
||||
{
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'hiring_policies' => 'array',
|
||||
'locations' => 'array',
|
||||
'profile_visibility' => 'array',
|
||||
'public_contact' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
@@ -28,4 +39,11 @@ class BuyerProfile extends Model
|
||||
{
|
||||
return $this->morphMany(Rating::class, 'rateable');
|
||||
}
|
||||
|
||||
public function visible(string $field): bool
|
||||
{
|
||||
$visibility = $this->profile_visibility ?? [];
|
||||
|
||||
return (bool) ($visibility[$field] ?? true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user