Sometimes you might want to disable mass assignment protection in Laravel and to do that you have to call the "unguard()" method of the base Model class.
The above code should be called from the "boot" method of the "AppServiceProvider" class.
class AppServiceProvider extends ServiceProvider
* Bootstrap any application services.
* @return void
public function boot()
By having this "unguard" method called, you will have to make sure that any data that come into the Laravel be validated before storing it into the database.
class PostController extends Controller
public function store(Request $request)
$request->validate([/* validate your fields here */]);