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