akaunting/app/Http/Requests/Portal/InvoiceShow.php

40 lines
726 B
PHP
Raw Permalink Normal View History

2020-09-06 17:06:10 +03:00
<?php
namespace App\Http\Requests\Portal;
use App\Abstracts\Http\FormRequest;
class InvoiceShow extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
2020-09-07 11:25:34 +03:00
if (auth()->guest()) {
return true;
}
// Allow admin to see signed invoice
if (user()->can('read-sales-invoices')) {
return true;
}
2020-09-06 17:06:10 +03:00
return $this->invoice->contact_id == user()->contact->id;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}