refactor(presentation): remove authorize method from FormRequests in favor of middleware filters
This commit is contained in:
parent
6be00bb21e
commit
6f35e031fa
7 changed files with 4 additions and 30 deletions
|
|
@ -17,11 +17,6 @@ final class EmployeeShowRequest extends FormRequest
|
|||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@ final class EmployeesIndexRequest extends FormRequest
|
|||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function sorter(): EmployeeSorter
|
||||
{
|
||||
return new EmployeeSorter($this->sortBy(), $this->direction());
|
||||
|
|
|
|||
|
|
@ -17,11 +17,6 @@ final class IncoCompositionShowRequest extends FormRequest
|
|||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
|
|
|
|||
|
|
@ -38,11 +38,6 @@ final class IncoSheetsIndexRequest extends FormRequest
|
|||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function sorter(): IncoSheetSorter
|
||||
{
|
||||
return new IncoSheetSorter($this->sortBy(), $this->direction());
|
||||
|
|
|
|||
|
|
@ -24,11 +24,6 @@ final class IncoSheetsSearchRequest extends FormRequest
|
|||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function incoIdSearch(): IncoIdQuery
|
||||
{
|
||||
return new IncoIdQuery($this->string('incoIdLike')->value());
|
||||
|
|
|
|||
|
|
@ -17,11 +17,6 @@ final class IncoSheetsShowRequest extends FormRequest
|
|||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ describe('Presentation Architecture Rules', function (): void {
|
|||
->expect('Presentation\Api\V1\Http\Requests')
|
||||
->not->toHaveMethod('toInput');
|
||||
|
||||
arch('Presentation FormRequests do not contain authorize method (auth is handled in middleware filters)')
|
||||
->expect('Presentation\Api\V1\Http\Requests')
|
||||
->not->toHaveMethod('authorize');
|
||||
|
||||
arch('Presentation layer uses strict types')
|
||||
->expect('Presentation')
|
||||
->toUseStrictTypes();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue