for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Providers;
use \Chriscreates\Blog\Post;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
class BlogServiceProvider extends ServiceProvider
{
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
parent::boot();
Route::bind('post', function ($value) {
return Post::where(function ($query) use ($value) {
$query->where('id', $value)
->orWhere('slug', 'LIKE', "%{$value}%");
})->first();
});
}
* Define the routes for the application.
public function map()
$this->mapBlogRoutes();
* Define the "api" routes for the application.
* These routes are typically stateless.
protected function mapBlogRoutes()
Route::middleware('api')
->namespace($this->namespace)
->group(base_path('routes/blog.php'));