2022-03-05 16:02:12 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2022-05-09 07:00:33 +02:00
|
|
|
use Illuminate\Support\Facades\Cache;
|
2022-03-05 16:02:12 +01:00
|
|
|
|
|
|
|
class Locations extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
protected $fillable = ['name'];
|
|
|
|
|
|
|
|
protected $table = 'locations';
|
2022-05-09 07:00:33 +02:00
|
|
|
|
2022-07-22 15:49:18 +02:00
|
|
|
protected $keyType = 'string';
|
|
|
|
|
2022-05-09 07:00:33 +02:00
|
|
|
public static function allLocations(): array
|
|
|
|
{
|
|
|
|
return Cache::remember("locations", now()->addMonth(1), function () {
|
2023-08-19 15:52:59 +02:00
|
|
|
return self::orderBy('name')->get()->toArray();
|
2022-05-09 07:00:33 +02:00
|
|
|
});
|
|
|
|
}
|
2022-03-05 16:02:12 +01:00
|
|
|
}
|