Skip to content

Commit

Permalink
Merge pull request #11 from RapidKit/fix/abstract-class-request
Browse files Browse the repository at this point in the history
fix/abstract class request
  • Loading branch information
ramaID authored Jun 22, 2024
2 parents b7f42db + d7a68b3 commit 074bb42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/Bases/BaseData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace RapidKit\LaravelRestify\Bases;

class BaseData extends \Spatie\LaravelData\Data
{
}
class BaseData extends \Spatie\LaravelData\Data {}
17 changes: 6 additions & 11 deletions src/Bases/BaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Illuminate\Foundation\Http\FormRequest;

class BaseRequest extends FormRequest
abstract class BaseRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
Expand All @@ -21,15 +21,10 @@ public function authorize(): bool
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
abstract public function rules(): array;

public function toDto()
{
return BaseData::from(...$this->all());
}
/**
* Convert the request to a DTO.
*/
abstract public function toDto(): BaseData;
}
4 changes: 1 addition & 3 deletions src/LaravelRestify.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace RapidKit\LaravelRestify;

class LaravelRestify
{
}
class LaravelRestify {}

0 comments on commit 074bb42

Please sign in to comment.