User company addded
This commit is contained in:
@@ -2,4 +2,44 @@
|
||||
|
||||
namespace App\Modules\Bank\Repositories;
|
||||
|
||||
class BankRepository {}
|
||||
use App\Modules\AppHelpers\Repositories\CacheRepository;
|
||||
use App\Modules\Bank\Models\Bank;
|
||||
use App\Modules\Makeable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class BankRepository
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/** @var Builder<Bank> */
|
||||
protected Builder $query;
|
||||
|
||||
/**
|
||||
* Cache name
|
||||
*/
|
||||
protected static string $cacheName = 'BANK_REPOSITORY';
|
||||
|
||||
/**
|
||||
* Bank repository
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->query = Bank::query();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return available options
|
||||
*
|
||||
* @return Collection<array-key, mixed>|array<string, string>
|
||||
*/
|
||||
public function options(): Collection|array
|
||||
{
|
||||
return CacheRepository::make(
|
||||
name: static::$cacheName.'_options',
|
||||
value: fn () => $this->query->get(['id', 'name', 'bab'])->mapWithKeys(fn ($item) => [
|
||||
$item->id => $item->name.' - '.$item->bab,
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user