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