22 ms·
Putting files in the right places? You can technically put them anywhere you like, and just use proper namespacing. For example laravel defaults to App/ for mo
by gremlinsinc 9y ago
Putting files in the right places? You can technically put them anywhere you like, and just use proper namespacing.
For example laravel defaults to App/ for models.. so App\User which is ugly if you have 50 models. I ALWAYS use App\Models\User instead, so I move it to the App\Models folder, put all my other models there and presto, chango.
Have you looked at validation in laravel 5.6?
Use Validator
...
$v = Validator::make($request->all(), [
'email' => 'required|unique:users'
]);
if($v->fails()){ return $v->errors()->first(); }
.. continue we passed validation.. If you can't grok the code above in laravel, not sure what you suggest that would be better.