2017-06-23 09:55:45 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Repositories;
|
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
use App\Contracts\Repository;
|
2017-06-23 09:55:45 +08:00
|
|
|
use App\Models\Subfleet;
|
2017-12-02 00:53:33 +08:00
|
|
|
use Prettus\Repository\Contracts\CacheableInterface;
|
2018-02-21 12:33:09 +08:00
|
|
|
use Prettus\Repository\Traits\CacheableRepository;
|
2017-06-23 09:55:45 +08:00
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
class SubfleetRepository extends Repository implements CacheableInterface
|
2017-06-23 09:55:45 +08:00
|
|
|
{
|
2017-12-02 00:53:33 +08:00
|
|
|
use CacheableRepository;
|
2017-08-25 02:03:10 +08:00
|
|
|
|
2017-12-02 00:53:33 +08:00
|
|
|
protected $fieldSearchable = [
|
|
|
|
'name' => 'like',
|
|
|
|
'type' => 'like',
|
2017-06-23 09:55:45 +08:00
|
|
|
];
|
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2017-06-23 09:55:45 +08:00
|
|
|
public function model()
|
|
|
|
{
|
|
|
|
return Subfleet::class;
|
|
|
|
}
|
2020-02-09 02:29:34 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the list of aircraft formatted for a select box
|
|
|
|
*
|
|
|
|
* @param bool $add_blank
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function selectBoxList($add_blank = false): array
|
|
|
|
{
|
|
|
|
$retval = [];
|
|
|
|
$items = $this->all();
|
|
|
|
|
|
|
|
if ($add_blank) {
|
|
|
|
$retval[''] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($items as $i) {
|
2021-04-23 21:44:37 +08:00
|
|
|
$retval[$i->id] = $i->name.' | '.$i->airline->icao;
|
2020-02-09 02:29:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return $retval;
|
|
|
|
}
|
2017-06-23 09:55:45 +08:00
|
|
|
}
|