urameshibr / lumen-form-request by LucasRodriguesBR

Laravel Form Request adaptation for Lumen framework.
285,072
3
1
Package Data
Maintainer Username: LucasRodriguesBR
Package Create Date: 2017-07-20
Package Last Update: 2022-11-11
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-16 15:01:35
Package Statistics
Total Downloads: 285,072
Monthly Downloads: 4,011
Daily Downloads: 51
Total Stars: 3
Total Watchers: 1
Total Forks: 1
Total Open Issues: 5

lumen-form-request

Laravel Form Request adaptation for Lumen framework

How to install

Lumen 5.5

composer require urameshibr/lumen-form-request:1.4

Lumen 5.6 +

composer require urameshibr/lumen-form-request
  • Add the service provider in bootstrap/app.php
$app->register(Urameshibr\Providers\FormRequestServiceProvider::class);

Next step is create your FormRequest and extends from Urameshibr/Requests/FormRequest

Example

<?php

namespace App\Http\Requests;

use Urameshibr\Requests\FormRequest;

class StoreDeviceRequest extends FormRequest
{
	public function authorize()
	{
		return true;
	}

	public function rules()
	{
		return [
			'mac_address' => 'required|unique:devices,mac_address'
		];
	}
}
  • Link for Laravel Form Request documentation

https://laravel.com/docs/5.4/validation#available-validation-rules

Enjoy!