Do I Really Need This Route Anymore?
Clean out old code can be hard. When your application has numerous javascript widgets, blade templates and forms you can not easily say what routes are being used. But with just a few artisan commands we can easily make this happen.
Also this can help with knowing what routes your Tests are NOT covering.
Package can be found here as well.
The Commands to Get Started
php artisan make:model RouteUsage
php artisan make:middleware RouteUsageTracker
php artisan make:migration route_usage_tracker_table
php artisan make:console RouteReport
Migration
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RouteUsageTrackerTable extends Migration
{
public function up()
{
Schema::create('route_usages', function (Blueprint $table) {
$table->increments('id');
$table->string('path');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('route_usages');
}
}
Link:
This post is submitted by our members. Submit a new post.
Tags: Tutorials Laravel 5 Laravel 5.1