Laravel Classroom image

Prashant  Nigam / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9|Last
Lessons:-Using Controllers

3.4 RESTful Controllers
RESTful web applications respond to meaningful HTTP verbs with appropriate data. They are
very useful when building public API’s for your applications.
With Laravel you can have your controller actions respond to individual HTTP verbs using
RESTful controller actions, let’s see this in action.
1 <?php
2
3 // application/controllers/home.php
4 class Home_Controller extends Base_Controller
5 {
6 public $restful = true;
7
8 public function get_index()
9 {
10 //
11 }
12
13 public function post_index()
14 {
15 //
16 }
17
18 }Simply add a boolean public class attribute named $restful and set it to true, then prefix your
actions with the HTTP verb to respond to rather than action_.
Common HTTP verbs are GET, POST, PUT and DELETE.

 

 
 
 

Prashant  Nigam

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)