nikidze/laravel-adr-generator

生成动作、请求和响应

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

This package is auto-updated.

Last update: 2024-09-17 22:17:21 UTC


README

Latest Stable Version Total Downloads Monthly Downloads License

Laravel 仓库生成器是一个用于 Laravel 8 的包,用于从 Eloquent 模型生成仓库。

安装

从您的终端运行以下命令

composer require "nikidze/laravel-adr-generator"

用法

生成您的动作、响应和请求。

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()
    {

    }
}