canDo('buyadetail.buyadetails.view') && $user->isAdmin()) { return true; } return $buyadetails->user_id == user_id() && $buyadetails->user_type == user_type(); } /** * Determine if the given user can create a buyadetails. * * @param UserPolicy $user * @param Buyadetails $buyadetails * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('buyadetail.buyadetails.create'); } /** * Determine if the given user can update the given buyadetails. * * @param UserPolicy $user * @param Buyadetails $buyadetails * * @return bool */ public function update(UserPolicy $user, Buyadetails $buyadetails) { if ($user->canDo('buyadetail.buyadetails.edit') && $user->isAdmin()) { return true; } return $buyadetails->user_id == user_id() && $buyadetails->user_type == user_type(); } /** * Determine if the given user can delete the given buyadetails. * * @param UserPolicy $user * @param Buyadetails $buyadetails * * @return bool */ public function destroy(UserPolicy $user, Buyadetails $buyadetails) { return $buyadetails->user_id == user_id() && $buyadetails->user_type == user_type(); } /** * Determine if the given user can verify the given buyadetails. * * @param UserPolicy $user * @param Buyadetails $buyadetails * * @return bool */ public function verify(UserPolicy $user, Buyadetails $buyadetails) { if ($user->canDo('buyadetail.buyadetails.verify')) { return true; } return false; } /** * Determine if the given user can approve the given buyadetails. * * @param UserPolicy $user * @param Buyadetails $buyadetails * * @return bool */ public function approve(UserPolicy $user, Buyadetails $buyadetails) { if ($user->canDo('buyadetail.buyadetails.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; } } }