phpvms/app/Repositories/AirlineRepository.php

40 lines
749 B
PHP
Raw Normal View History

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