/** * List Client Staff * @return \Illuminate\Http\JsonResponse */ public function index() { if (\Input::get('client_id')) { if (\Input::has('type')) { $staff = Client::find(\Input::get('client_id'))->staff()->whereType(\Input::get('type')->get()); } else { $staff = Client::find(\Input::get('client_id'))->staff; } return \Response::json(['data' => $staff]); } }
} }, 'client.show' => function ($clientId) { $client = Client::find($clientId); if (Auth::user()->hasMtmAgency(Agency::find($client->agency_id))) { return true; } }, 'agent.create' => function () { $agencyId = Input::get('agency_id', false); if ($agencyId && Auth::user()->hasMtmAgency(Agency::find($agencyId))) { return true; } }, 'staff.create' => function () { $clientId = \Input::get('client_id'); $client = Client::find($clientId); if (Auth::user()->hasMtmAgency(Agency::find($client->agency_id))) { return true; } }, 'staff.read' => function ($clientId) { $client = Client::find($clientId); if (Auth::user()->hasMtmAgency(Agency::find($client->agency_id))) { return true; } }, 'job.create' => function () { $clientId = \Input::get('client_id'); $client = Client::find($clientId); if (Auth::user()->hasMtmAgency(Agency::find($client->agency_id))) { return true; } }]); ACL::withRole('SaaS Client Admin')->grant(['*.create' => true, '*.read' => true, '*.update' => true, '*.delete' => true]); ACL::withRole('Super Admin')->grant(['*.create' => true, '*.read' => true, '*.update' => true, '*.delete' => true]);
/** * List Client Jobs * @return \Illuminate\Http\JsonResponse */ public function jobs($client_id) { $jobs = Client::find($client_id)->jobs()->with('skills')->paginate(); return $this->respondWithCollection($jobs, new JobTransformer(), ['skills']); }