phpvms/app/Repositories/AirlineRepository.php
2017-12-01 11:27:32 -06:00

40 lines
749 B
PHP

<?php
namespace App\Repositories;
use App\Models\Airline;
use Prettus\Repository\Contracts\CacheableInterface;
use Prettus\Repository\Traits\CacheableRepository;
class AirlineRepository extends BaseRepository implements CacheableInterface
{
use CacheableRepository;
protected $fieldSearchable = [
'code',
'name' => 'like',
];
public function model()
{
return Airline::class;
}
/**
* Return the list of airline formatted for a select box
* @return array
*/
public function selectBoxList(): array
{
$retval = [];
$items = $this->all();
foreach ($items as $i) {
$retval[$i->id] = $i->name;
}
return $retval;
}
}