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