canDo('music.form.view') && $user->isAdmin()) { return true; } return $form->user_id == user_id() && $form->user_type == user_type(); } /** * Determine if the given user can create a form. * * @param UserPolicy $user * @param Form $form * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('music.form.create'); } /** * Determine if the given user can update the given form. * * @param UserPolicy $user * @param Form $form * * @return bool */ public function update(UserPolicy $user, Form $form) { if ($user->canDo('music.form.edit') && $user->isAdmin()) { return true; } return $form->user_id == user_id() && $form->user_type == user_type(); } /** * Determine if the given user can delete the given form. * * @param UserPolicy $user * @param Form $form * * @return bool */ public function destroy(UserPolicy $user, Form $form) { return $form->user_id == user_id() && $form->user_type == user_type(); } /** * Determine if the given user can verify the given form. * * @param UserPolicy $user * @param Form $form * * @return bool */ public function verify(UserPolicy $user, Form $form) { if ($user->canDo('music.form.verify')) { return true; } return false; } /** * Determine if the given user can approve the given form. * * @param UserPolicy $user * @param Form $form * * @return bool */ public function approve(UserPolicy $user, Form $form) { if ($user->canDo('music.form.approve')) { return true; } return false; } /** * Determine if the user can perform a given action ve. * * @param [type] $user [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($user, $ability) { if ($user->isSuperuser()) { return true; } } }