rafflesargentina / l5-action-based-form-request by rafflesargentina

Action based form request for Laravel
163
0
2
Package Data
Maintainer Username: rafflesargentina
Maintainer Contact: mario@raffles.com.ar (Mario Patronelli)
Package Create Date: 2017-12-27
Package Last Update: 2018-12-15
Language: PHP
License: MIT
Last Refreshed: 2024-12-15 15:07:26
Package Statistics
Total Downloads: 163
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Action Based FormRequest for Laravel 5

Latest Version on Packagist Software License Build Status Total Downloads

Action Based FormRequest for Laravel 5

Install

Via Composer

$ composer require rafflesargentina/l5-action-based-form-request

Usage

Create a class that extends ActionBasedFormRequest. Then define methods that match the name of each action with request data you want to validate, returning an array with rules.

Example:

<?php

namespace App\Http\Requests;

use RafflesArgentina\ActionBasedFormRequest\ActionBasedFormRequest;

class ArticleRequest extends ActionBasedFormRequest
{
    public static function index()
    {
        return [
            'show' => 'numeric|min:1|max:400',
            'order' => 'in:asc,desc',
        ];
    }

    public static function store()
    {
        return [
            'title' => 'required|max:100',
        ];
    }

    public static function update()
    {
        return static::store();
    } 
}

And that's it :)

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email mario@raffles.com.ar instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.