Skip to Main Content
Hands-On Full Stack Web Development with Angular 6 and Laravel 5
book

Hands-On Full Stack Web Development with Angular 6 and Laravel 5

by Fernando Monteiro
July 2018
Intermediate to advanced content levelIntermediate to advanced
420 pages
8h 46m
English
Packt Publishing
Content preview from Hands-On Full Stack Web Development with Angular 6 and Laravel 5

Creating and updating the controller function

  1. Open your Terminal window and type the following command:

php artisan make:controller API/BuilderController --api

Note that the --api flag creates four methods for us inside the BuilderController class:

  • index() = GET
  • store() = POST
  • show($id) = GET
  • update(Request $request, $id) = PUT
  • destroy($id) = POST
  1. Open project/app/Http/Controllers/API/BuilderController.php and add the App\Builder code right after the Controller import.

  2. Now, let's add the content for each method. Open project/app/Http/Controllers/API/BuilderController.php and replace the content with the following code:

<?phpnamespace App\Http\Controllers\API;use Illuminate\Http\Request;use App\Http\Controllers\Controller;use App\Builder; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Laravel: Up and Running

Laravel: Up and Running

Matt Stauffer
Building Large-Scale Web Applications with Angular

Building Large-Scale Web Applications with Angular

Chandermani Arora, Kevin Hennessy, Christoffer Noring, Doguhan Uluca

Publisher Resources

ISBN: 9781788833912Supplemental Content