Skip to content

Commit 92214c5

Browse files
Prepagertaylorotwell
authored andcommitted
[5.4] Add apiResource function to Router (#19347)
* Add apiResource function to Router * Style CI fix * Removed unnecessary tab
1 parent 653dc3d commit 92214c5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Illuminate/Routing/Router.php

+15
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,21 @@ public function resource($name, $controller, array $options = [])
253253
$registrar->register($name, $controller, $options);
254254
}
255255

256+
/**
257+
* Route an api resource to a controller.
258+
*
259+
* @param string $name
260+
* @param string $controller
261+
* @param array $options
262+
* @return void
263+
*/
264+
public function apiResource($name, $controller, array $options = [])
265+
{
266+
$this->resource($name, $controller, array_merge([
267+
'only' => ['index', 'show', 'store', 'update', 'destroy'],
268+
], $options));
269+
}
270+
256271
/**
257272
* Create a route group with shared attributes.
258273
*

0 commit comments

Comments
 (0)