vendredi 28 décembre 2018

all value is not inserted in my database (laravel-5.7)

I trying to insert value into database by form in laravel but my all value's is not inserted .
..insert only email,password,created_date
Here is my code of migration :-

    Schema::defaultStringLength(191);
    Schema::create('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('fname');
        $table->string('lname');
        $table->string('email')->unique();
        $table->string('phone');
        $table->string('gender');
        $table->string('dob');
        $table->string('religion');
        $table->string('mtn');
        $table->string('country');
        $table->string('city');
        $table->string('district');
        $table->string('upozila');
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });


here is code of controller :-

public function register(Request $request)
{
    $this->validation($request);
    User::create($request->all());
    return redirect('/');
}

public function validation($request)
{
    $validatedData = $request->validate([
    'fname' => 'required|max:255',
    'lname' => 'required|max:255',
    'email' => 'required|email|max:255|unique:users,email',
    'phone' => 'required|max:255',
    'gender' => 'required|max:255',
    'dob' => 'required|max:255',
    'religion' => 'required|max:255',
    'mtn' => 'required|max:255',
    'country' => 'required|max:255',
    'city' => 'required|max:255',
    'district' => 'required|max:255',
    'upozila' => 'required|max:255',
    'password' => 'required|min:6',
    'confirm_password' =>'required|min:6|same:password',

]);

}


here is my array = $request->all(); :

_token "wDRoDeLkOFX5re5nba2Ufv5pr0iKzYVCr0tK9EFE"
fname "nirab"
lname "nirax"
email "is@gmail.com"
phone "988907"
gender "male"
dob "2018-12-03"
religion "male"
mtn "male"
country "male"
city "male"
district "male"
upozila "male"
password "1234567"
confirm_password "1234567"



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire