1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Http/Requests/CreateProposalCategoryRequest.php
2019-01-30 22:25:07 +11:00

32 lines
731 B
PHP

<?php
namespace App\Http\Requests;
use App\Models\Proposal;
use App\Models\ProposalCategory;
class CreateProposalCategoryRequest extends ProposalCategoryRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->can('create', Proposal::class) || $this->user()->can('create', ProposalCategory::class);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => sprintf('required|unique:proposal_categories,name,,id,account_id,%s', $this->user()->account_id),
];
}
}