when I'm trying to store a new row this error appears
SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value
(SQL: insert into
cats
(updated_at
,created_at
) values (2020-08-08 22:32:29, 2020-08-08 22:32:29))
using Laravel 5.8
my Controller
public function store(Request $request)
{
$form_data = array(
'name' => $request->name,
);
Cat::create($form_data);
return redirect('admin')->with('success', 'Data Added successfully.');
//Cat::create($form_data);
dd($request->name);
}
my model is:
<?PHP
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Model;
class Cat extends Model
{
use Notifiable;
protected $guarded = [];
protected $fillable = ['nama'];
public function products()
{
return $this->hasMany(Product::class);
}
}
name
has a default value