Skip to content

Commit 02ceeb4

Browse files
committed
Added 'AJAXful' routing
1 parent aae8b62 commit 02ceeb4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

laravel/routing/controller.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ abstract class Controller {
3333
*/
3434
public $restful = false;
3535

36+
/**
37+
* Indicates if the controller uses AJAXful routing.
38+
*
39+
* @var bool
40+
*/
41+
public $ajaxful = false;
42+
3643
/**
3744
* The filters assigned to the controller.
3845
*
@@ -320,6 +327,11 @@ public function response($method, $parameters = array())
320327
$action = "action_{$method}";
321328
}
322329

330+
if ($this->ajaxful && Request::ajax())
331+
{
332+
$action = "ajax_{$action}";
333+
}
334+
323335
$response = call_user_func_array(array($this, $action), $parameters);
324336

325337
// If the controller has specified a layout view the response

0 commit comments

Comments
 (0)