<?php namespace Bixo\Shop\Policies; use Bixo\Shop\Models\SparePart; use Illuminate\Foundation\Auth\User as Authenticatable; trait SparePartAction { /** * Determine if the given user can copy the given spare_part. * * @param Authenticatable $user * * @return bool */ public function copy(Authenticatable $user, SparePart $spare_part) { if ($authUser->canDo('shop.spare_part.action.copy')) { return true; } $this->model->is_owner; } /** * Determine if the given user can empty the given spare_part. * * @param Authenticatable $user * * @return bool */ function empty(Authenticatable $user, SparePart $spare_part) { if ($authUser->canDo('shop.spare_part.action.empty')) { return true; } $this->model->is_owner; } /** * Determine if the given user can transfer the given spare_part. * * @param Authenticatable $user * * @return bool */ public function transfer(Authenticatable $user, SparePart $spare_part) { if ($authUser->canDo('shop.spare_part.action.transfer')) { return true; } $this->model->is_owner; } }