First use as below;
public function store(Request $request)
{
Hall::create($request->all());
return "not important";
}
Second use as below;
public function store(Request $request)
{
if($request){
Hall::create($request->all());
return "not important";
}
}
Do you need control with if
? Which makes more sense
No need really for If statement
.
What the create
method does, is create a new Element (in your case Hall), and save it in the database, taking into consideration the possible attributes in your model.
So when you define your model (Hall), you should have something like follow:
public Hall extends Model
{
public $table = 'halls';
protected $fillable = ['column1', 'column2'];// all attributes that should be filled in with create method.
}
Then, for the validation of your request, you can make a request php artisan make:request HallRequest
, and there you defin your validation.