SQLSTATE : Общая ошибка: 1364 Поле «фото» не имеет значения по умолчанию в laravel 5.5

Я пытаюсь загрузить фото пользователей во время регистрации, но я получаю эту ошибку, я искал в Интернете и основал возможные решения, которые не работали для меня. Я использую дозорный пакет для расширенной аутентификации. Пожалуйста, помогите мне. Вот мой контроллер –

public function postRegister(Request $request){ $request->validate([ 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'user_name' => 'unique:users|max:255', 'email' => 'required|unique:users|email|max:255', 'password' => 'required|min:6|confirmed', 'phone' => 'required|numeric', ]); //upload image if ($file = $request->file('photo')) { $fileName = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension() ?: 'png'; $folderName = '/uploads/users/'; $destinationPath = public_path() . $folderName; $safeName = str_random(10) . '.' . $extension; $file->move($destinationPath, $safeName); $request['photo'] = $safeName; } // $user = Sentinel::registerAndActivate($request->all()); $user = Sentinel::registerAndActivate($request->all()); // dd($user); //$activation = Activation::create($user); $role = Sentinel::findRoleBySlug('member'); $role->users()->attach($user); //$this->sendEmail($user, $activation->code); //return redirect('/login'); return ('You have seccsessfully registered. Now login to start'); } 

И введите input- (с enctype = "multipart / form-data" вершиной формы)

  <div class="row"> <div class="col-md-6"> <div class="sponsor-row"> <label for="sponsor_input"><i class="fa fa-tags"></i></label> <input type="text" name="sponsor" id="sponsor_input" class="sponsor-input" placeholder="Sponsor"></input> </div> </div> <div class="col-md-6"> <div class="photo-row"> <label for="photo_input"></label> <input type="file" name="photo" id="photo" class="photo-input"></input> </div> </div> </div> </div> 

Моя модель пользователя:

 <?php 

namespace App;

использовать Illuminate \ Notifications \ Notifiable; используйте Illuminate \ Foundation \ Auth \ User как Authenticatable;

class User extends Authenticatable {use Notifiable;

 /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'first_name', 'last_name', 'user_name','email', 'password', 'phone', 'location', 'sponsor', 'photo', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; 

}

Мой код миграции:

 Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('first_name')->nullable(); $table->string('last_name')->nullable(); $table->string('user_name'); $table->string('email'); $table->string('password'); $table->string('phone'); $table->string('location'); $table->string('sponsor'); $table->binary('photo')->nullable(); $table->text('permissions')->nullable(); $table->timestamp('last_login')->nullable(); $table->timestamps(); $table->engine = 'InnoDB'; $table->unique('email'); }); 

Related of "SQLSTATE : Общая ошибка: 1364 Поле «фото» не имеет значения по умолчанию в laravel 5.5"