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:39:03 +02:00
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
2022-03-05 16:02:12 +01:00
|
|
|
|
|
|
|
class Providers extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
protected $fillable = ['name'];
|
|
|
|
|
|
|
|
protected $table = 'providers';
|
2022-05-09 07:39:03 +02:00
|
|
|
|
|
|
|
public static function allProviders(): array
|
|
|
|
{
|
|
|
|
return Cache::remember("providers", now()->addMonth(1), function () {
|
|
|
|
return DB::table('providers')->get()->toArray();
|
|
|
|
});
|
|
|
|
}
|
2022-03-05 16:02:12 +01:00
|
|
|
}
|