Clean up Award controller in admin #155

This commit is contained in:
Nabeel Shahzad
2018-03-17 11:39:51 -05:00
parent 7feecb507d
commit a21e2dd412
2 changed files with 20 additions and 24 deletions

View File

@@ -22,23 +22,22 @@ class AwardController extends BaseController
/** /**
* Display a listing of the Fare. * Display a listing of the Fare.
*
* @param Request $request * @param Request $request
*
* @return Response * @return Response
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$this->awardRepository->pushCriteria(new RequestCriteria($request)); $this->awardRepository->pushCriteria(new RequestCriteria($request));
$awards = $this->awardRepository->all(); $awards = $this->awardRepository->all();
return view('admin.awards.index') return view('admin.awards.index', [
->with('awards', $awards); 'awards' => $awards,
]);
} }
/** /**
* Show the form for creating a new Fare. * Show the form for creating a new Fare.
*
* @return Response * @return Response
*/ */
public function create() public function create()
@@ -48,10 +47,9 @@ class AwardController extends BaseController
/** /**
* Store a newly created Fare in storage. * Store a newly created Fare in storage.
* * @param CreateAwardRequest $request
* @param CreateFareRequest $request
*
* @return Response * @return Response
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/ */
public function store(CreateAwardRequest $request) public function store(CreateAwardRequest $request)
{ {
@@ -64,27 +62,25 @@ class AwardController extends BaseController
/** /**
* Display the specified Fare. * Display the specified Fare.
*
* @param int $id * @param int $id
*
* @return Response * @return Response
*/ */
public function show($id) public function show($id)
{ {
$fare = $this->awardRepository->findWithoutFail($id); $award = $this->awardRepository->findWithoutFail($id);
if (empty($award)) { if (empty($award)) {
Flash::error('Award not found'); Flash::error('Award not found');
return redirect(route('admin.awards.index')); 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 * @param int $id
*
* @return Response * @return Response
*/ */
public function edit($id) public function edit($id)
@@ -95,16 +91,17 @@ class AwardController extends BaseController
return redirect(route('admin.awards.index')); 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. * Update the specified award in storage.
* * @param int $id
* @param int $id * @param UpdateAwardRequest $request
* @param UpdateFareRequest $request
*
* @return Response * @return Response
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/ */
public function update($id, UpdateAwardRequest $request) public function update($id, UpdateAwardRequest $request)
{ {

View File

@@ -20,9 +20,8 @@ abstract class AwardInterface
protected $user; protected $user;
/** /**
* Each award class just needs to return true or false if it * Each award class just needs to return true or false if it should actually
* should actually be awarded to a user. This is the only method that * be awarded to a user. This is the only method that needs to be implemented
* needs to be implemented
* @param null $params Optional parameters that are passed in from the UI * @param null $params Optional parameters that are passed in from the UI
* @return bool * @return bool
*/ */