Why use fillable in Laravel

User::create($request->all());
$arrayOfData = ['name' => 'Doe', 'email' => 'test@test.com', ...];
User::create($arrayOfData);
$user = new User;
$user->fill($arrayOfData);
$user = new User;
$user->name = $request->input('name');
$user->email = $request->input('email');
...
...
$user->save();

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mohd Daud Khan

Mohd Daud Khan

13 Followers

Strong engineering professional skilled in PHP, Laravel, and JavaScript.