From a21e2dd4120fa336f4cb5c661cff863d7f5e84f0 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 17 Mar 2018 11:39:51 -0500 Subject: [PATCH] Clean up Award controller in admin #155 --- .../Controllers/Admin/AwardController.php | 39 +++++++++---------- app/Interfaces/AwardInterface.php | 5 +-- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/Admin/AwardController.php b/app/Http/Controllers/Admin/AwardController.php index 733e54fd..c7f6804f 100755 --- a/app/Http/Controllers/Admin/AwardController.php +++ b/app/Http/Controllers/Admin/AwardController.php @@ -22,23 +22,22 @@ class AwardController extends BaseController /** * Display a listing of the Fare. - * * @param Request $request - * * @return Response + * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function index(Request $request) { $this->awardRepository->pushCriteria(new RequestCriteria($request)); $awards = $this->awardRepository->all(); - return view('admin.awards.index') - ->with('awards', $awards); + return view('admin.awards.index', [ + 'awards' => $awards, + ]); } /** * Show the form for creating a new Fare. - * * @return Response */ public function create() @@ -48,10 +47,9 @@ class AwardController extends BaseController /** * Store a newly created Fare in storage. - * - * @param CreateFareRequest $request - * + * @param CreateAwardRequest $request * @return Response + * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function store(CreateAwardRequest $request) { @@ -64,27 +62,25 @@ class AwardController extends BaseController /** * Display the specified Fare. - * * @param int $id - * * @return Response */ public function show($id) { - $fare = $this->awardRepository->findWithoutFail($id); + $award = $this->awardRepository->findWithoutFail($id); if (empty($award)) { Flash::error('Award not found'); return redirect(route('admin.awards.index')); } - return view('admin.awards.show')->with('award', $award); + return view('admin.awards.show', [ + 'award' => $award, + ]); } /** - * Show the form for editing the specified Fare. - * + * Show the form for editing the specified award. * @param int $id - * * @return Response */ public function edit($id) @@ -95,16 +91,17 @@ class AwardController extends BaseController return redirect(route('admin.awards.index')); } - return view('admin.awards.edit')->with('award', $award); + return view('admin.awards.edit', [ + 'award' => $award, + ]); } /** - * Update the specified Fare in storage. - * - * @param int $id - * @param UpdateFareRequest $request - * + * Update the specified award in storage. + * @param int $id + * @param UpdateAwardRequest $request * @return Response + * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function update($id, UpdateAwardRequest $request) { diff --git a/app/Interfaces/AwardInterface.php b/app/Interfaces/AwardInterface.php index 809e3764..cc1be4b3 100644 --- a/app/Interfaces/AwardInterface.php +++ b/app/Interfaces/AwardInterface.php @@ -20,9 +20,8 @@ abstract class AwardInterface protected $user; /** - * Each award class just needs to return true or false if it - * should actually be awarded to a user. This is the only method that - * needs to be implemented + * Each award class just needs to return true or false if it should actually + * be awarded to a user. This is the only method that needs to be implemented * @param null $params Optional parameters that are passed in from the UI * @return bool */