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