Complete the code to define a route that uses the HomeController's index method.
Route::get('/', [[1]::class, 'index']);
The route needs to specify the controller class name, here HomeController, to call its index method.
Complete the code to create a new controller named ProductController using Artisan command.
php artisan make:[1] ProductControllerThe Artisan command to create a controller is make:controller.
Fix the error in the controller method to return a view named 'welcome'.
public function index() {
return [1]('welcome');
}In Laravel, the view() helper function returns a view. It should be lowercase.
Fill both blanks to pass data from controller to view with variable 'name' set to 'Laravel'.
return view('greeting', [[1] => [2]]);
The array key is the variable name in the view, and the value is the data passed.
Fill all three blanks to define a model named Post with a fillable property for 'title' and 'content'.
class [1] extends Model { protected $[2] = [[3]]; }
The model class is named Post. The fillable property is an array of fields allowed for mass assignment.