mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 23:42:32 +01:00
20058cb9c9
Issue 56 & 57 fix?
27 lines
576 B
PHP
27 lines
576 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class Locations extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['name'];
|
|
|
|
protected $table = 'locations';
|
|
|
|
protected $keyType = 'string';
|
|
|
|
public static function allLocations(): array
|
|
{
|
|
return Cache::remember("locations", now()->addMonth(1), function () {
|
|
return DB::table('locations')->get()->toArray();
|
|
});
|
|
}
|
|
}
|