You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's some boilerplate I've noticed in controllers that should be refactored. Many controllers need to determine if the current user is the creator of a model object or has permission to view / edit it. This logic could probably be handled by a custom middleware with a couple parameters.
// Did the current user create this application?if($application->user->id != Auth::user()->id)
{
$request->session()->flash('error', 'Only the person who created an application may change it.');
returnredirect('/login');
}
The text was updated successfully, but these errors were encountered:
Another example which appears in the ApplicationController and AnswerController:
if($application->status != 'new')
{
$request->session()->flash('error', 'Your application has been submitted, you may no longer make changes.');
returnredirect('/applications/' . $application->id . '/review');
}
There's some boilerplate I've noticed in controllers that should be refactored. Many controllers need to determine if the current user is the creator of a model object or has permission to view / edit it. This logic could probably be handled by a custom middleware with a couple parameters.
The text was updated successfully, but these errors were encountered: