Solution:1
Validator is a facade. Facades aren’t enabled by default in lumen.
If you would like to use the a facade, you should uncomment the
$app->withFacades();
call in your bootstrap/app.php
file.
Solution:1
Validator is a facade. Facades aren’t enabled by default in lumen.
If you would like to use the a facade, you should uncomment the
$app->withFacades();
call in your bootstrap/app.php
file.
Solution:2
This is for Lumen version 5.3 (as shown in the docs):
use Illuminate\Http\Request;
$app->post('/user', function (Request $request) {
$this->validate($request, [
'name' => 'required',
'email' => 'required|email|unique:users'
]);
// Store User...
});