Package Data | |
---|---|
Maintainer Username: | albertcht |
Maintainer Contact: | albert.cht@gmail.com (Albert Chen) |
Package Create Date: | 2017-12-29 |
Package Last Update: | 2020-04-22 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 15:11:02 |
Package Statistics | |
---|---|
Total Downloads: | 14,839 |
Monthly Downloads: | 1 |
Daily Downloads: | 1 |
Total Stars: | 10 |
Total Watchers: | 2 |
Total Forks: | 8 |
Total Open Issues: | 2 |
A package that helps developer to segregate the validation logic from controller to a separate dedicated class. Lumen doesn't have any FormRequest
class like Laravel. This will let you do that.
composer require albertcht/lumen-form-request
bootstrap/app.php
$app->register(AlbertCht\Form\FormRequestServiceProvider::class);
Next step is create your FormRequest and extends from AlbertCht\Form\FormRequest
<?php
namespace App\Http\Requests;
use AlbertCht\Form\FormRequest;
class StoreDeviceRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'mac_address' => 'required|unique:devices,mac_address'
];
}
}