Files
roxane/app/Models/Service.php

54 lines
2.1 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* @property int $id
* @property string $identifier
* @property string $name
* @property string|null $description
* @property string $url
* @property string|null $icon
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property string|null $deleted_at
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Membership> $memberships
* @property-read int|null $memberships_count
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereIcon($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereIdentifier($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Service whereUrl($value)
* @mixin \Eloquent
*/
class Service extends Model
{
protected $fillable = [
'identifier',
'name',
'description',
'url',
'icon',
];
public static function getAttributeLabel(string $attribute): string
{
return __('services.fields.' . $attribute);
}
public function memberships() : BelongsToMany
{
return $this->belongsToMany(Membership::class, 'services_memberships', 'service_id', 'membership_id');
}
}