Skip to content

Resource controllers

Marco E edited this page Aug 28, 2020 · 1 revision
vagrant@meeting-api:~/code$ php artisan make:controller API/MeetingController --api
vagrant@meeting-api:~/code$ php artisan make:controller API/RegistrationController --resource
vagrant@meeting-api:~/code$ php artisan make:controller API/AuthController
  • Keep only the store and destroy method in the RegistrationController.php.
  • Because we created the MeetingController.php file with the --api tag the create and edit methods are already not present in the file (which is what we want, so no need to modify this controller).
  • Add the store and the signin methods manually to the AuthController.php.
public function store (Request $request)
{
    return "It works!";
}

public function signin (Request $request)
{
    return "It works!";
}
  • For test purpose, add the return string return "It works!"; for every method of the 3 controllers.

Clone this wiki locally