Forum General Route annotation in Laravel 5
Laravel 5 now includes route annotation. Which means now you can have a controller like this:
<?php namespace App\Http\Controllers; use Illuminate\Routing\Controller; /** * @Resource("foobar/photos", only={"index", "update"}, names={"index": "index.name"}) * @Controller(domain="{id}.account.com") * @Before("auth") * @Before("csrf", on={"post", "put", "delete"}) * @Where({"id": "regex"}) */ class BasicController extends Controller { /** * @Before("inline") * @return Response */ public function index() {} /** * @Before("inline") * @After("inline") * @return Response */ public function update($id) {} /** * @Put("/more/{id}", after="log") */ public function doMore($id) {} }
Then you have to run php artisan route:scan and Laravel will cache all annotated routes in storage/framework/routes.scanned.php
php artisan route:scan
storage/framework/routes.scanned.php
What do you guys think of this feature?
Please sign in or create an account to participate in this conversation.
There's no shortage of content at Laracasts. In fact, you could watch nonstop for days upon days, and still not see everything!
Get Started
Route annotation in Laravel 5
Laravel 5 now includes route annotation. Which means now you can have a controller like this:
Then you have to run
php artisan route:scan
and Laravel will cache all annotated routes instorage/framework/routes.scanned.php
What do you guys think of this feature?