Static Analysis Cleanup

This commit is contained in:
David Bomba 2023-08-20 14:44:07 +10:00
parent dc63ead58c
commit 0457090226
11 changed files with 40 additions and 20 deletions

View File

@ -22,7 +22,10 @@ class UploadBankIntegrationRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->bank_integration); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->bank_integration);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadBankTransactionRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->bank_transaction); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->bank_transaction);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadClientRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->client); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->client);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadCreditRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->credit); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->credit);
} }
public function rules() public function rules()

View File

@ -50,14 +50,4 @@ class UpdateDocumentRequest extends Request
$this->replace($input); $this->replace($input);
} }
/**
* Convert to boolean
*
* @param $bool
* @return bool
*/
private function toBoolean($bool): bool
{
return filter_var($bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
}
} }

View File

@ -22,7 +22,10 @@ class UploadExpenseRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->expense); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->expense);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadPaymentRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->payment); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->payment);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadProductRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->product); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->product);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadProjectRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->project); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->project);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadPurchaseOrderRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->purchase_order); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->purchase_order);
} }
public function rules() public function rules()

View File

@ -22,7 +22,10 @@ class UploadQuoteRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->can('edit', $this->quote); /** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('edit', $this->quote);
} }
public function rules() public function rules()