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