First of all, I have to tell that I am totally new on Laravel, so if you thing I am in the wrong way, please correct me.
Notice, that I have the Laravel 5.1 installed on my application.
I creating an application and I like to have my breadcrumbs inside an array, so I decide to create a Service Provider, and the code for the Service Provider is the following:
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
class BreadCrumbsServiceProvider extends ServiceProvider
{
// This will contain all the breadcrumb crumbs
protected $crumbs = [];
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->createBreadcrumb();
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->singleton(
'crumbs',
function() {
return $this->crumbs;
}
);
}
protected function createBreadcrumb( ) {
dd( Route::current() );
}
}
So ,when I run my site, the dd
returns just null
. Can someone help me with this situation ?