<?php namespace Bixo\Account\Policies; use Bixo\Account\Models\Customer; use Illuminate\Foundation\Auth\User as Authenticatable; trait CustomerWorkflow { /** * Determine if the given user can approve the given customer. * * @param Authenticatable $user * * @return bool */ public function approve(Authenticatable $user, Customer $customer) { if ($user->canDo('account.customer.approve')) { return true; } return false; } /** * Determine if the given user can approve the given customer. * * @param Authenticatable $user * * @return bool */ public function submit(Authenticatable $user, Customer $customer) { if ($user->canDo('account.customer.submit')) { return true; } return false; } /** * Determine if the given user can approve the given customer. * * @param Authenticatable $user * * @return bool */ public function publish(Authenticatable $user, Customer $customer) { if ($user->canDo('account.customer.publish')) { return true; } return false; } /** * Determine if the given user can approve the given customer. * * @param Authenticatable $user * * @return bool */ public function unpublish(Authenticatable $user, Customer $customer) { if ($user->canDo('account.customer.unpublish')) { return true; } return false; } /** * Determine if the given user can approve the given customer. * * @param Authenticatable $user * * @return bool */ public function archive(Authenticatable $user, Customer $customer) { if ($user->canDo('account.customer.archive')) { return true; } return false; } /** * Determine if the given user can approve the given customer. * * @param Authenticatable $user * * @return bool */ public function unarchive(Authenticatable $user, Customer $customer) { if ($user->canDo('account.customer.unarchive')) { return true; } return false; } /** * Determine if the given user can approve the given customer. * * @param Authenticatable $user * * @return bool */ public function reject(Authenticatable $user, Customer $customer) { if ($user->canDo('account.customer.reject')) { return true; } return false; } }