2020-09-06 23:50:36 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Engelsystem\Models;
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
2023-01-22 18:43:09 +01:00
|
|
|
use Engelsystem\Models\Shifts\NeededAngelType;
|
2023-12-27 03:18:05 +01:00
|
|
|
use Engelsystem\Models\Shifts\Schedule;
|
2023-01-03 22:19:03 +01:00
|
|
|
use Engelsystem\Models\Shifts\Shift;
|
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
2021-07-10 00:59:20 +02:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2023-12-27 03:18:05 +01:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
2023-01-03 22:19:03 +01:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2020-09-06 23:50:36 +02:00
|
|
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
|
|
|
|
|
|
|
/**
|
2023-01-22 18:43:09 +01:00
|
|
|
* @property int $id
|
|
|
|
* @property string $name
|
|
|
|
* @property string $map_url
|
|
|
|
* @property string $description
|
|
|
|
* @property string $dect
|
|
|
|
* @property Carbon|null $created_at
|
|
|
|
* @property Carbon|null $updated_at
|
2023-01-03 22:19:03 +01:00
|
|
|
*
|
2023-12-27 03:18:05 +01:00
|
|
|
* @property-read Collection|Schedule[] $activeForSchedules
|
2023-01-22 18:43:09 +01:00
|
|
|
* @property-read Collection|NeededAngelType[] $neededAngelTypes
|
|
|
|
* @property-read Collection|Shift[] $shifts
|
2020-09-06 23:50:36 +02:00
|
|
|
*
|
2023-10-15 19:25:55 +02:00
|
|
|
* @method static QueryBuilder|Location[] whereId($value)
|
|
|
|
* @method static QueryBuilder|Location[] whereName($value)
|
|
|
|
* @method static QueryBuilder|Location[] whereMapUrl($value)
|
|
|
|
* @method static QueryBuilder|Location[] whereDect($value)
|
|
|
|
* @method static QueryBuilder|Location[] whereDescription($value)
|
|
|
|
* @method static QueryBuilder|Location[] whereCreatedAt($value)
|
|
|
|
* @method static QueryBuilder|Location[] whereUpdatedAt($value)
|
2020-09-06 23:50:36 +02:00
|
|
|
*/
|
2023-10-15 19:25:55 +02:00
|
|
|
class Location extends BaseModel
|
2020-09-06 23:50:36 +02:00
|
|
|
{
|
2021-07-10 00:59:20 +02:00
|
|
|
use HasFactory;
|
|
|
|
|
2020-09-06 23:50:36 +02:00
|
|
|
/** @var bool Enable timestamps */
|
2022-12-15 19:50:56 +01:00
|
|
|
public $timestamps = true; // phpcs:ignore
|
2020-09-06 23:50:36 +02:00
|
|
|
|
2023-08-29 17:43:45 +02:00
|
|
|
/** @var array<string, null> default attributes */
|
|
|
|
protected $attributes = [ // phpcs:ignore
|
|
|
|
'map_url' => null,
|
|
|
|
'description' => null,
|
|
|
|
'dect' => null,
|
|
|
|
];
|
|
|
|
|
2022-12-15 19:50:56 +01:00
|
|
|
/** @var array<string> */
|
|
|
|
protected $fillable = [ // phpcs:ignore
|
2020-09-06 23:50:36 +02:00
|
|
|
'name',
|
2022-10-18 17:34:08 +02:00
|
|
|
'dect',
|
2020-09-06 23:50:36 +02:00
|
|
|
'map_url',
|
|
|
|
'description',
|
|
|
|
];
|
2023-01-03 22:19:03 +01:00
|
|
|
|
2023-12-27 03:18:05 +01:00
|
|
|
public function activeForSchedules(): BelongsToMany
|
|
|
|
{
|
|
|
|
return $this->belongsToMany(Schedule::class, 'schedule_locations');
|
|
|
|
}
|
|
|
|
|
2023-01-22 18:43:09 +01:00
|
|
|
public function neededAngelTypes(): HasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(NeededAngelType::class);
|
|
|
|
}
|
|
|
|
|
2023-01-03 22:19:03 +01:00
|
|
|
public function shifts(): HasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(Shift::class);
|
|
|
|
}
|
2020-09-06 23:50:36 +02:00
|
|
|
}
|