add setting to disable user aircraft rank restriction #138
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Services\UserService;
|
||||
use Log;
|
||||
use Flash;
|
||||
use Response;
|
||||
@@ -33,7 +34,8 @@ class PirepController extends BaseController
|
||||
$aircraftRepo,
|
||||
$pirepSvc,
|
||||
$pirepRepo,
|
||||
$subfleetRepo;
|
||||
$subfleetRepo,
|
||||
$userSvc;
|
||||
|
||||
public function __construct(
|
||||
AirportRepository $airportRepo,
|
||||
@@ -41,7 +43,8 @@ class PirepController extends BaseController
|
||||
AircraftRepository $aircraftRepo,
|
||||
PirepRepository $pirepRepo,
|
||||
PIREPService $pirepSvc,
|
||||
SubfleetRepository $subfleetRepo
|
||||
SubfleetRepository $subfleetRepo,
|
||||
UserService $userSvc
|
||||
) {
|
||||
$this->airportRepo = $airportRepo;
|
||||
$this->airlineRepo = $airlineRepo;
|
||||
@@ -49,10 +52,13 @@ class PirepController extends BaseController
|
||||
$this->pirepRepo = $pirepRepo;
|
||||
$this->pirepSvc = $pirepSvc;
|
||||
$this->subfleetRepo = $subfleetRepo;
|
||||
$this->userSvc = $userSvc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dropdown with aircraft grouped by subfleet
|
||||
* @param null $user
|
||||
* @return array
|
||||
*/
|
||||
public function aircraftList($user=null)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Repositories\SubfleetRepository;
|
||||
use App\Services\UserService;
|
||||
use Auth;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,12 +18,16 @@ use App\Http\Resources\User as UserResource;
|
||||
|
||||
class UserController extends RestController
|
||||
{
|
||||
protected $userRepo, $userSvc;
|
||||
protected $subfleetRepo,
|
||||
$userRepo,
|
||||
$userSvc;
|
||||
|
||||
public function __construct(
|
||||
SubfleetRepository $subfleetRepo,
|
||||
UserRepository $userRepo,
|
||||
UserService $userSvc
|
||||
) {
|
||||
$this->subfleetRepo = $subfleetRepo;
|
||||
$this->userRepo = $userRepo;
|
||||
$this->userSvc = $userSvc;
|
||||
}
|
||||
|
||||
@@ -58,16 +58,13 @@ class PirepController extends Controller
|
||||
|
||||
/**
|
||||
* Dropdown with aircraft grouped by subfleet
|
||||
* @param null $user
|
||||
* @return array
|
||||
*/
|
||||
public function aircraftList($user=null)
|
||||
{
|
||||
$aircraft = [];
|
||||
|
||||
if ($user === null) {
|
||||
$subfleets = $this->subfleetRepo->all();
|
||||
} else {
|
||||
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
||||
}
|
||||
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
||||
|
||||
foreach ($subfleets as $subfleet) {
|
||||
$tmp = [];
|
||||
|
||||
Reference in New Issue
Block a user