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