I get an error when trying to run this, but it might be a database error, this is how it's done, yea?
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class UserController extends Controller { # create user public function createUser(Request $request) { $this->validate($request, [ 'name' => 'required|unique:users|min:4' ]); } } @stop namespacing in the Request function, and than use it to validate the POST-variablesAlso, if I want the name to be between 3 and 13 characters, can I type something like: @codeblock $this->validate($request, [ 'name' => 'required|unique:users|min:4, max:12' ]); @stop ?
You can use the 'between' rule for that.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community