phpvms/app/Repositories/AircraftRepository.php

45 lines
917 B
PHP
Raw Normal View History

2017-06-09 09:37:51 +08:00
<?php
namespace App\Repositories;
use App\Interfaces\Repository;
2017-06-09 09:37:51 +08:00
use App\Models\Aircraft;
use Prettus\Repository\Contracts\CacheableInterface;
2018-02-21 12:33:09 +08:00
use Prettus\Repository\Traits\CacheableRepository;
2017-06-09 09:37:51 +08:00
/**
* Class AircraftRepository
*/
class AircraftRepository extends Repository implements CacheableInterface
2017-06-09 09:37:51 +08:00
{
use CacheableRepository;
protected $fieldSearchable = [
'name' => 'like',
'registration' => 'like',
'active',
];
2017-06-09 09:37:51 +08:00
public function model()
{
return Aircraft::class;
}
/**
* Return the list of aircraft formatted for a select box
2018-08-27 00:40:04 +08:00
*
* @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->subfleet->name.' - '.$i->name.' ('.$i->registration.')';
}
return $retval;
}
2017-06-09 09:37:51 +08:00
}