nikidze/laravel-adr-generator

Generate actions, requests and responses

v0.0.3 2022-01-17 16:10 UTC

This package is auto-updated.

Last update: 2024-10-17 22:32:10 UTC


README

Latest Stable Version Total Downloads Monthly Downloads License

Laravel Repositories generator is a package for Laravel 8 which is used to generate reposiotries from eloquent models.

Installation

Run the following command from you terminal:

composer require "nikidze/laravel-adr-generator"

Usage

Generate your actions, responses and requests.

php artisan make:adr Auth/Login
<?php

namespace App\Actions\Auth;

use App\Responses\Auth\LoginResponse;
use App\Requests\Auth\LoginRequest;

class LoginAction {

    public function __construct(
        private LoginResponse $response
    ) {}

    public function __invoke(LoginRequest $request)
    {
    }
}
<?php

namespace App\Requests\Auth;

use Illuminate\Foundation\Http\FormRequest;

class LoginRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [

        ];
    }
}
<?php

<?php

namespace App\Responses\Auth;

class LoginResponse {

    public function respond()
    {

    }
}