Git Product home page Git Product logo

laravel-breadcrumbs's People

Contributors

a1tem avatar andreyco avatar arcanedev-maroc avatar baijunyao avatar boris-glumpler avatar christian-thomas avatar d13r avatar dabich avatar danielgelling avatar dwightwatson avatar freddiecoleman avatar jacurtis avatar kerwitz avatar levacic avatar nyholm avatar omranic avatar tabuna avatar tedslittlerobot avatar yahya-uddin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-breadcrumbs's Issues

Config restores to default one after publishing

Hi!

I've just taken the stuff from the readme, changed view to _partials.breadcrumbs which I have in my views folder.
When I publish config via console, the value is changed back to laravel-breadcrumbs::bootstrap3.
Any ideas?
Thanks.

Reassigning entry names causes stack overflow error

On my local machine simple routes like the following work:

Breadcrumbs::register( 'home', function( $breadcrumbs ) {
    $breadcrumbs->push( 'Homepage', route( 'home' ) );
} );
Breadcrumbs::register( 'articles.index', function( $breadcrumbs ) {
    $breadcrumbs->push( 'Articles', route( 'home' ) );
} );

But the following will cause Apache to crash:

Breadcrumbs::register( 'admin.articles.update', function( $breadcrumbs ) {
    $breadcrumbs->push( 'Update article', route( 'home' ) );
} );

Any hints?

Thanks in advance!

Update: the crash also happens with more then two underscores but everything else with equal length works well. I guess underscores are somewhat treated the same way dots are?

Okay this is kind of bugging. These combinations will currently cause Apache to crash:

  • one.two.three
  • one_two_three
  • one-two-three

The problem lies within the $breadcrumbs->parent() method as a route can have one of the above combinations as a name and will only cause the error once it gets a parent like "one-two-three" or one of the above.

Question with routes.php.

So I've installed the package and I can't seem to get anything, but errors. So if someone doesn't mind just guiding me through by starting off with a bread crumb for two static pages?

In app/breadcrumbs.php I have:

<?php

Breadcrumbs::register('home', function($breadcrumbs) {
    $breadcrumbs->push('Home', route('home'));
});

Breadcrumbs::register('about', function($breadcrumbs) {
    $breadcrumbs->parent('home');
    $breadcrumbs->push('About', route('about'));
});

In

app/routes.php I have:

Route::get('/', function()
{
    return View::make('pages.home');
});
Route::get('/about', function()
{
    return View::make('pages.about');
});

which is where my question is. How do I modify my routes.php to work with breadcrumbs?

Using this with FbF/Laravel-Blog

This is FbF/Laravel-Blog's routes.php:

<?php

// Main default listing e.g. http://domain.com/blog
Route::get(Config::get('laravel-blog::routes.base_uri'), 'Fbf\LaravelBlog\PostsController@index');

// Archive (year / month) filtered listing e.g. http://domain.com/blog/yyyy/mm
Route::get(Config::get('laravel-blog::routes.base_uri').'/{year}/{month}', 'Fbf\LaravelBlog\PostsController@indexByYearMonth')->where(array('year' => '\d{4}', 'month' => '\d{2}'));

if (Config::get('laravel-blog::routes.relationship_uri_prefix'))
{
    // Relationship filtered listing, e.g. by category or tag, e.g. http://domain.com/blog/category/my-category
    Route::get(Config::get('laravel-blog::routes.base_uri').'/'.Config::get('laravel-blog::routes.relationship_uri_prefix').'/{relationshipIdentifier}', 'Fbf\LaravelBlog\PostsController@indexByRelationship');
}

// Blog post detail page e.g. http://domain.com/blog/my-post
Route::get(Config::get('laravel-blog::routes.base_uri').'/{slug}', 'Fbf\LaravelBlog\PostsController@view');

// RSS feed URL e.g. http://domain.com/blog.rss
Route::get(Config::get('laravel-blog::routes.base_uri').'.rss', 'Fbf\LaravelBlog\PostsController@rss');

I am so confused as to how to make breadcrumbs out of this.

Can someone point my in the right direction?

problem when use {{ Breadcrumbs::render('home') }}?

I have problem when render, it show error message like:

ErrorException
Illegal offset type in isset or empty (View: D:\wamp\www\laravel\app\views\hello.blade.php)

open: D:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php
     * Get the fully qualified location of the view.
     *
     * @param  string  $name
     * @return string
     */
    public function find($name)
    {
        if (isset($this->views[$name])) return $this->views[$name];

        if (strpos($name, '::') !== false)

Please help me.

"Class 'DaveJamesMiller\Breadcrumbs\BreadcrumbsServiceProvider' not found"

If you install in a local environment, you perform the following steps:

  • Update composer.json
  • Run composer update
  • Add the following to app/config/app.php:
    • 'DaveJamesMiller\Breadcrumbs\BreadcrumbsServiceProvider',
    • 'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs',

And this all works fine.

The problem comes in when you deploy to staging or another server. In this case, the relevant code has already been inserted into app/config/app.php, but composer has not yet been installed or updated. You get hit with the following error message:

"Class 'DaveJamesMiller\Breadcrumbs\BreadcrumbsServiceProvider' not found" 

Its impossible to run any composer or artisan commands until you comment the relevant lines in app/config/app.php (and then uncomment them once composer has done its thing).

I've not seen this behaviour with any other package.

Unable to generate a URL

Hey Dave,

Nice package but I cant get it working on a Laravel4 project.

Install was pretty simple and here is my setup.

app/breadcrumbs.php

Breadcrumbs::register('home', function($breadcrumbs) {
    $breadcrumbs->push('Home', route('home'));
});

layout.blade.php

@yield('breadcrumbs')

index.blade.php

{{ Breadcrumbs::render('home') }}

Unable to generate a URL for the named route "home" as such route does not exist.

Am I missing something?

How to use 2nd argument of the callback function (of Breadcrumb::register)?

Hi, in my view I use this:

@section('breadcrumbs', Breadcrumbs::render('user', $bc_pages))

with $bc_pages is an array of array:

array(2) { [0]=> array(2) { ["title"]=> string(5) "Users" ["url"]=> string(33) "http://localhost:8080/admin/users" } [1]=> array(2) { ["title"]=> string(23) "admin/users/title.staff" ["url"]=> string(39) "http://localhost:8080/admin/users/staff" } } 

In my breadcrumbs.php:

Breadcrumbs::register('user', function($breadcrumbs, $bc_pages) {
// dd($bc_pages);
    foreach ($bc_pages as $page) {dd($page);
        $breadcrumbs->push($page['title'], url($page['url']));
    }
});

This didn't work for me. As I use dd($bc_pages) to dump the variable out, it shows me:

array(2) { ["title"]=> string(5) "Users" ["url"]=> string(33) "http://localhost:8080/admin/users" } 

It means that $bc_pages is altered somewhere. Can you tell me how to use this second argument of the callback function please? Sorry for the readability.

Edited for readability -DJM

Custom view not working at all

If i set:

'view' => 'laravel-breadcrumbs::_partials.breadcrumbs',

And then output it in a view:

{{ Breadcrumbs::render('home') }}

it throws me an error:

View [_partials.breadcrumbs] not found.

Though i have created a view under app/views/_partials/breadcrumbs.blade.php and placed the code here.

So it's not working. Can you fix it?

URL::previous Breadcrumbs?

Hi there,

I have a search feature on my website which I would like to breadcrumb, so that users can jump back to their search results with ease. For example:

Without search, they may go Root > Shows > ShowName > ShowYear > RaceName

With search: Root > Search > Search Query > RaceName

How can I change how the breadcrumb is rendered on RaceName, depending on how the user got there? Is there a way to leverage cookies or URL::previous?

Thanks.

Trying to Get Property of Non-Object

Thank you for this package! Really awesome work.

I'm having a problem that's driving me nuts. When trying to register the pages in my app I get a non-object error.

ROUTE

Route::get('pages/{id}', array('as' => 'admin.pages.edit', 'uses' => 'PagesController@edit'));

CONTROLLER

public function edit($id) {
  $data = ['page' => Page::find($id)];
  return View::make('admin/index')->nest('child', 'admin/pages/edit', $data);
}

BREADCRUMS.PHP

Breadcrumbs::register('admin.pages.edit', function($breadcrumbs, $page) {
    $breadcrumbs->parent('admin.pages.index');
    $breadcrumbs->push('$page->title', route('admin.pages.edit', $page->id));
});

VIEW

{{ HtmlHelper::clear() }}
{{ Breadcrumbs::render() }}
{{ HtmlHelper::clear(20) }}

this is working {{ $page->id }}

In the view $page->id returns the correct id so the $page object is being passed to the view

Any idea what might be causing the error? Thanks again for your work.
Matt

Edited: Fat fingers.

Illegal offset type in isset or empty

I'm getting an Illegal offset type in isset or empty error.
Background: I'm creating a package for easy deployment of the code I use for every website I make. I've even tried to deploy the package but get the same error.

Providers from config/app.php

'providers' => array(

        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        'Illuminate\Cache\CacheServiceProvider',
        'Illuminate\Session\CommandsServiceProvider',
        'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
        'Illuminate\Routing\ControllerServiceProvider',
        'Illuminate\Cookie\CookieServiceProvider',
        'Illuminate\Database\DatabaseServiceProvider',
        'Illuminate\Encryption\EncryptionServiceProvider',
        'Illuminate\Filesystem\FilesystemServiceProvider',
        'Illuminate\Hashing\HashServiceProvider',
        'Illuminate\Html\HtmlServiceProvider',
        'Illuminate\Log\LogServiceProvider',
        'Illuminate\Mail\MailServiceProvider',
        'Illuminate\Database\MigrationServiceProvider',
        'Illuminate\Pagination\PaginationServiceProvider',
        'Illuminate\Queue\QueueServiceProvider',
        'Illuminate\Redis\RedisServiceProvider',
        'Illuminate\Remote\RemoteServiceProvider',
        'Illuminate\Auth\Reminders\ReminderServiceProvider',
        'Illuminate\Database\SeedServiceProvider',
        'Illuminate\Session\SessionServiceProvider',
        'Illuminate\Translation\TranslationServiceProvider',
        'Illuminate\Validation\ValidationServiceProvider',
        'Illuminate\View\ViewServiceProvider',
        'Illuminate\Workbench\WorkbenchServiceProvider',

        'Cartalyst\Sentry\SentryServiceProvider',   //Required For DCN's Auth Package
        'Cviebrock\EloquentSluggable\SluggableServiceProvider', //Required For DCN's Blog And Page Packages
        'Baum\BaumServiceProvider', //Required For DCN's Blog And Page Packages
        'DaveJamesMiller\Breadcrumbs\ServiceProvider', //required for all DCN packages

        'Dcn\Auth\AuthServiceProvider',         //DCN's Auth Package        

        'Dcn\Blog\BlogServiceProvider',         //DCN's Blog Package

        'Dcn\Pages\PagesServiceProvider',           //DCN's Page Package

    ),

Aliases from config/app.php

'aliases' => array(

        'App'             => 'Illuminate\Support\Facades\App',
        'Artisan'         => 'Illuminate\Support\Facades\Artisan',
        'Auth'            => 'Illuminate\Support\Facades\Auth',
        'Blade'           => 'Illuminate\Support\Facades\Blade',
        'Cache'           => 'Illuminate\Support\Facades\Cache',
        'ClassLoader'     => 'Illuminate\Support\ClassLoader',
        'Config'          => 'Illuminate\Support\Facades\Config',
        'Controller'      => 'Illuminate\Routing\Controller',
        'Cookie'          => 'Illuminate\Support\Facades\Cookie',
        'Crypt'           => 'Illuminate\Support\Facades\Crypt',
        'DB'              => 'Illuminate\Support\Facades\DB',
        'Eloquent'        => 'Illuminate\Database\Eloquent\Model',
        'Event'           => 'Illuminate\Support\Facades\Event',
        'File'            => 'Illuminate\Support\Facades\File',
        'Form'            => 'Illuminate\Support\Facades\Form',
        'Hash'            => 'Illuminate\Support\Facades\Hash',
        'HTML'            => 'Illuminate\Support\Facades\HTML',
        'Input'           => 'Illuminate\Support\Facades\Input',
        'Lang'            => 'Illuminate\Support\Facades\Lang',
        'Log'             => 'Illuminate\Support\Facades\Log',
        'Mail'            => 'Illuminate\Support\Facades\Mail',
        'Paginator'       => 'Illuminate\Support\Facades\Paginator',
        'Password'        => 'Illuminate\Support\Facades\Password',
        'Queue'           => 'Illuminate\Support\Facades\Queue',
        'Redirect'        => 'Illuminate\Support\Facades\Redirect',
        'Redis'           => 'Illuminate\Support\Facades\Redis',
        'Request'         => 'Illuminate\Support\Facades\Request',
        'Response'        => 'Illuminate\Support\Facades\Response',
        'Route'           => 'Illuminate\Support\Facades\Route',
        'Schema'          => 'Illuminate\Support\Facades\Schema',
        'Seeder'          => 'Illuminate\Database\Seeder',
        'Session'         => 'Illuminate\Support\Facades\Session',
        'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
        'SSH'             => 'Illuminate\Support\Facades\SSH',
        'Str'             => 'Illuminate\Support\Str',
        'URL'             => 'Illuminate\Support\Facades\URL',
        'Validator'       => 'Illuminate\Support\Facades\Validator',
        'View'            => 'Illuminate\Support\Facades\View',

        'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry',

        'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',

    ),

One of my views

<p>
{{\Dcn\Pages\Page::navigation()}}
</p>
<p>
{{ Breadcrumbs::render('Pages-Home') }}
</p>
<h1>{{$page->title}}</h1>
<p>Created by {{$page->writer->first_name}} {{$page->writer->last_name}}</p>
<p>Last Update: {{$page->updated_at}} By: {{$page->updater->first_name}} {{$page->updater->last_name}}</p>
{{$page->content}}

my breadcrumbs.php

<?php

Breadcrumbs::register('Pages-Home', function($breadcrumbs) {
    $breadcrumbs->push('Home', route('Pages-Home'));
});

Breadcrumbs::register('Pages-ContactUs', function($breadcrumbs) {
    $breadcrumbs->parent('Pages-Home');
    $breadcrumbs->push('Contact Us', route('Pages-ContactUs'));
});

Breadcrumbs::register('Pages-TermsOfService', function($breadcrumbs) {
    $breadcrumbs->parent('Pages-Home');
    $breadcrumbs->push('Terms Of Service', route('Pages-TermsOfService'));
});

Breadcrumbs::register('Pages-PrivacyPolicy', function($breadcrumbs) {
    $breadcrumbs->parent('Pages-Home');
    $breadcrumbs->push('Privacy Policy', route('Pages-PrivacyPolicy'));
});

Breadcrumbs::register('Pages-View', function($breadcrumbs, $page) {
    $breadcrumbs->parent('Pages-Home');

    foreach ($page->getAncestors() as $ancestor) {
        $breadcrumbs->push($ancestor->title, route('Pages-View', $ancestor->slug));
    }

    $breadcrumbs->push($page->title, route('Pages-View', $page->slug));
});

My service Providor

<?php namespace Dcn\Pages;

use Illuminate\Support\ServiceProvider;

class PagesServiceProvider extends ServiceProvider {

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('dcn/pages');

        include __DIR__.'/../../routes.php';
        include __DIR__.'/../../breadcrumbs.php';
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return array();
    }

}

Laravel Version 4.2.6
PHP Version 5.4.20

Full package code can be found at: https://github.com/DynamicCodeNinja/pages

I'm sure its something simple I'm missing, but I will continue to debug and look into it.

The only weird thing, is that if I add
Breadcrumbs::setView('laravel-breadcrumbs::bootstrap3'); into my breadcumbs.php file it works. So I think that the config isn't being loaded properly.

Breadcrumbs::exists()

Hello is there a Breadcrumbs::exists() function ?

That would be very good because I dont want to define a breadcrumb for every page.

Laravel 5 support

  • Update composer.json #49 #50
  • Update path to breadcrumbs.php #53
  • Add to test app
  • Update documentation (new location for config files, new version supported)
  • Release it

Cannot implement this in the laravel 4

Done everything by the book, even reoptimize the code with php-cli artisan dump-autoload and php-cli artisan optimize.

But it still says that Class 'Breadcrumbs' not found, i've tried this in the breadcrums.pbp and routes.php also, but it's still not working.

2013-07-22_15-37

Doesn't work with Laravel 5.0

When using Laravel 5.0, composer throws an error when trying to install laravel-breadcrumbs. I think only composer.json needs to be updated, because laravel-breadcrumbs worked perfectly on 4.3 a few days ago.

Breadcrumbs::selected() method for highlighting menu items

I'm considering adding a Breadcrumbs::selected() (or active()?) method that lets you determine whether a given page is currently active, or is a parent of this page. This would help when building navigation menus.

// In app/breadcrumbs.php
Breadcrumbs::register('home', function($breadcrumbs) {
    $breadcrumbs->push('Home', route('home'));
});

Breadcrumbs::register('kb', function($breadcrumbs) {
    $breadcrumbs->parent('home');
    $breadcrumbs->push('Knowledgebase', route('kb'));
});

Breadcrumbs::register('kb.page', function($breadcrumbs, $page) {
    $breadcrumbs->parent('kb');
    $breadcrumbs->push($page->title, route('kb.page', $page->id));
});

// In view:
Breadcrumbs::render('kb.page', $page);

// In layout:
Breadcrumbs::selected('kb.page', $page); // true
Breadcrumbs::selected('kb'); // true
Breadcrumbs::selected('somethingelse'); // false

However, this depends on render() being called before selected(), which is not ideal. (See #16 for a possible solution.)

It is also not strictly related to breadcrumbs, so perhaps it should be done in a separate package...

There is a first attempt at this in 43688d3, but it only checks the current page, not the parents.

Add Breadcrumbs::group() support

Could i create group breadcrumb like Laravel Route Prefixing. Because i use resource controller.

Breadcrumbs::group('user.') {
    Breadcrumbs::register('index', function($breadcrumbs) {
       $breadcrumbs->push('User', route('user.index'));
    });
   Breadcrumbs::register('create', function($breadcrumbs) {
       $breadcrumbs->parent('user.index');
       $breadcrumbs->push('Add New', route('user.create'));
    });
});

If can, please example for me.

Problem with PHP 5.3

Hi,
package does not work with PHP 5.3, because the use of Callable.
This is the error:

Argument 2 passed to DaveJamesMiller\Breadcrumbs\BreadcrumbsManager::register() must be an instance of DaveJamesMiller\Breadcrumbs\Callable, instance of Closure given

Regards

Simplify class structure

The current class names are:

  • DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs
  • DaveJamesMiller\Breadcrumbs\BreadcrumbsGenerator
  • DaveJamesMiller\Breadcrumbs\BreadcrumbsGeneratorException
  • DaveJamesMiller\Breadcrumbs\BreadcrumbsManager
  • DaveJamesMiller\Breadcrumbs\BreadcrumbsServiceProvider

I am considering renaming them in v2.0 to:

  • DaveJamesMiller\Breadcrumbs\Facade
  • DaveJamesMiller\Breadcrumbs\Generator
  • DaveJamesMiller\Breadcrumbs\Exception
  • DaveJamesMiller\Breadcrumbs\Manager
  • DaveJamesMiller\Breadcrumbs\ServiceProvider

Implicit controllers usable

The documentation mentions that implicit controllers could not be used; but after a bit of hunting I've tested with Laravel 5.0.3, and it can be done by passing a third argument to Route::controller:

Route::controller('auth', 'Auth\AuthController', [
  'getRegister' => 'auth.register',
  'getLogin' => 'auth.login',
  'postRegister' => 'auth.register',
  'postLogin' => 'auth.login',
  'postLogout' => 'auth.logout',
]);

Just thought I'd leave this here for anybody interested in a solution.

How to show in Multilanguage?

Hii,

Its a perfect package, I want to show it in two languages English and Arabic. I implemented in English successful but how to show in Arabic.

Regards,

Breadcrumbs and glyphicons

I have a template that allows me to have an icon as the text of a link for a list item. Can I do this with this?

I was hoping to do something like this:

Breadcrumbs::register('users', function($breadcrumbs) {
    $breadcrumbs->push('<i class="glyphicon glyphicon-home">');
    $breadcrumbs->push('Users', route('users.index'));
});

Add support for not errorring out when a route is not set

I'm trying to use the App::missing() handler to handle my 404 errors nicely, while still having a call to Breadcrumbs::renderIfExists() in my parent template (Which I am expecting to not load any breadcrumbs).

However, if the page is 404ing and the route is not set anywhere, I get this error:

Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to a member function getName() on a non-object.

This is because here in /laravel-breadcrumbs/src/DaveJamesMiller/Breadcrumbs/Manager.php:

    protected function currentRoute()
    {
        if ($this->currentRoute)
            return $this->currentRoute;

        $route = $this->router->current();

        $name = $route->getName();
//...

It tries to access the getName() function of a route that doesn't exist.

For example if you have no route called "dfpoigsjpdofg" and you go to that URI App::missing() will handle the error, and I want to use my parent template to style a nice 404 page, but I have to override the breadcrumb call or else it'll error out like this.

If you'd be interested in merging this in, I'd be willing to add it in and drop you a pull request for it.

Laravel 5 - BadMethodCallException in ServiceProvider.php line 111: Call to undefined method [package]

breadcrumbs.php

Breadcrumbs::register('home', function($breadcrumbs) {
    $breadcrumbs->push('Home', '/');
});

my view

//...
{!! Breadcrumbs::render('home') !!}
//...

Error

BadMethodCallException in ServiceProvider.php line 111:
Call to undefined method [package]

in ServiceProvider.php line 111
at ServiceProvider->__call('package', array('davejamesmiller/laravel-breadcrumbs')) in ServiceProvider.php line 50
at ServiceProvider->package('davejamesmiller/laravel-breadcrumbs') in ServiceProvider.php line 50
at ServiceProvider->boot()
at call_user_func_array(array(object(ServiceProvider), 'boot'), array()) in Container.php line 530
at Container->call(array(object(ServiceProvider), 'boot')) in Application.php line 564
at Application->bootProvider(object(ServiceProvider)) in Application.php line 377
at Application->register(object(ServiceProvider)) in Application.php line 476
at Application->registerDeferredProvider('DaveJamesMiller\Breadcrumbs\ServiceProvider', 'breadcrumbs') in Application.php line 458
at Application->loadDeferredProvider('breadcrumbs') in Application.php line 502
at Application->make('breadcrumbs') in Container.php line 1191
at Container->offsetGet('breadcrumbs') in Facade.php line 148
at Facade::resolveFacadeInstance('breadcrumbs') in Facade.php line 118
at Facade::getFacadeRoot() in Facade.php line 202
at Facade::__callStatic('render', array('home')) in c51afa214851930e34b35b9f120f93e7 line 9
at Facade::render('home') in c51afa214851930e34b35b9f120f93e7 line 9
at include('/home/vagrant/Code/ead/storage/framework/views/c51afa214851930e34b35b9f120f93e7') in PhpEngine.php line 37
at PhpEngine->evaluatePath('/home/vagrant/Code/ead/storage/framework/views/c51afa214851930e34b35b9f120f93e7', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection), 'header_title' => 'O Cliente', 'header_subtitle' => 'Entendendo O Cliente', 'edit' => '/courses/4/lessons/5/edit', 'delete' => 'courses/4/lessons/5')) in CompilerEngine.php line 57
at CompilerEngine->get('/home/vagrant/Code/ead/resources/templates/courses/pageheader-edit.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection), 'header_title' => 'O Cliente', 'header_subtitle' => 'Entendendo O Cliente', 'edit' => '/courses/4/lessons/5/edit', 'delete' => 'courses/4/lessons/5')) in View.php line 136
at View->getContents() in View.php line 104
at View->renderContents() in View.php line 78
at View->render() in 04a3a5d2f2451fa4289af95c613de8f2 line 10
at include('/home/vagrant/Code/ead/storage/framework/views/04a3a5d2f2451fa4289af95c613de8f2') in PhpEngine.php line 37
at PhpEngine->evaluatePath('/home/vagrant/Code/ead/storage/framework/views/04a3a5d2f2451fa4289af95c613de8f2', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection))) in CompilerEngine.php line 57
at CompilerEngine->get('/home/vagrant/Code/ead/resources/templates/lessons/show.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'course' => object(Course), 'lesson' => object(Lesson), 'files' => object(Collection))) in View.php line 136
at View->getContents() in View.php line 104
at View->renderContents() in View.php line 78
at View->render() in Response.php line 44
at Response->setContent(object(View)) in Response.php line 202
at Response->__construct(object(View)) in Router.php line 1171
at Router->prepareResponse(object(Request), object(View)) in Router.php line 649
at Router->dispatchToRoute(object(Request)) in Router.php line 604
at Router->dispatch(object(Request)) in Kernel.php line 155
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 43
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 53
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Kernel.php line 108
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 83
at Kernel->handle(object(Request)) in index.php line 53

[PROPOSAL] Set the default view in a config file, rather than in application code

Rather than calling Breadcrumbs::setView, to change the view, specify the default view using a Config option - it seems awkward to have to set the view in application code.

suggested implementation:

eg. in your service provider, something like:

public function register()
{
    $this->app['breadcrumbs'] = $this->app->share(function($app)
    {
        $bc = new BreadcrumbsManager($app['view'])

        $bc->setView($app['config']['breadcrumbs::view.name']);

        return $bc;
    });
}

then set the default value in the a package resources config file.

Invalid argument supplied for foreach()

I can't figure out why this happen so therefor I am opening this issue.

this is the html

<ul class="breadcrumb">
                        @foreach( $breadcrumbs as $breadcrumb )    
                            @if ($breadcrumb->url && !$breadcrumb->last)
                                <li><a href="{{{ $breadcrumb->url }}}">{{{ $breadcrumb->title }}}</a></li>
                            @else
                                <li class="active">{{{ $breadcrumb->title }}}</li>
                            @endif
                        @endforeach
                    </ul>

and here my breadcrumbs.php file

<?php

Breadcrumbs::register( 'admin', function( $breadcrumbs ) {
    $breadcrumbs->push( 'Administration Panel', route( 'app.admin.dashboard' ) );
});

// Providers
Breadcrumbs::register( 'admin.providers.index', function( $breadcrumbs ) {
    $breadcrumbs->parent( 'admin' );
});

and here the render call

Breadcrumbs::render( 'admin' )

How to use a font icon ?

How can i use a font icon like FontAwesome ?

I tried :

$breadcrumbs->push('< i class="fa fa-home" > < /i >', route('admin.index'));

But the output is :

< i class="fa fa-home"> < /i >

Object oriented

It is possible to use this package in an object oriented way? Something like implements a Interface and define your breadcrumbs in a 'register' method.

Is because I'm in a project where all the code is object oriented so I don't want tiny files living over there.

Thanks :)

Bootstrap 3 RC1

For those using the latest version of Bootstrap 3 (at the time of writing RC1), a small change needs to be made.

http://getbootstrap.com/components/#breadcrumbs

Separators are automatically added in CSS through :before and content.

The view changes as follows:

@if ($breadcrumbs)
    <ul class="breadcrumb">
        @foreach ($breadcrumbs as $breadcrumb)
            @if (!$breadcrumb->last)
                <li>
                    <a href="{{{ $breadcrumb->url }}}">{{{ $breadcrumb->title }}}</a>
                </li>
            @else
                <li class="active">
                    {{{ $breadcrumb->title }}}
                </li>
            @endif
        @endforeach
    </ul>
@endif

See https://github.com/davejamesmiller/laravel-breadcrumbs#2-create-a-template-that-renders-the-breadcrumbs-optional for how to implement

Breadcrumb on resource returning non-object error

Hey, loving this package thus' far.

I've read through all docs, but unfortunately can't work out my issue.

ErrorException
Trying to get property of non-object (View: /Users/joedawson/Development/tekkers/app/views/layouts/single.blade.php) (View: /Users/joedawson/Development/tekkers/app/views/layouts/single.blade.php)

app/routes.php

Route::get('/', ['uses' => 'PagesController@home', 'as' => 'home']);
Route::resource('videos', 'VideosController');

app/controllers/VideosController.php

class VideosController extends \BaseController {

    public function index()
    {
        $videos = Video::all();
        return View::make('videos.index', compact('videos'));
    }

    public function show($slug)
    {
        $video = Video::where('slug', '=', $slug)->first();

        if(is_null($video)) {
            return Redirect::to('videos');
        }

        return View::make('videos.show', compact('video'));
    }

}

app/views/videos/show.blade.php

@extends('layouts.single')

@section('title', $video->title)

@section('content')
    {{ $video->description }}
@stop

app/views/layouts/single.blade.php

<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->
<head>
    @include('layouts.inc.meta')
</head>
<body>
    @include('layouts.inc.header')
    <div class="container">
        <div class="content">
            <h1>@yield('title')</h1>
            {{ Breadcrumbs::renderIfExists() }}
            @yield('content')
        </div>
        @include('layouts.inc.footer')
    </div>
</body>
</html>

app/breadcrumbs.php - I actually read through #18 for my breadcrumbs boilerplate.

Breadcrumbs::register('home', function($breadcrumbs) {
    $breadcrumbs->push('Home', route('home'));
});

Breadcrumbs::register('videos.index', function($breadcrumbs) {
    $breadcrumbs->parent('home');
    $breadcrumbs->push('Videos', route('videos.index'));
});

Breadcrumbs::register('videos.show', function($breadcrumbs, $video) {
    $breadcrumbs->parent('videos.index');
    $breadcrumbs->push($video->title, route('videos.index', $video->slug));
});

When I replace;

Breadcrumbs::register('videos.show', function($breadcrumbs, $video) {
    $breadcrumbs->parent('videos.index');
    $breadcrumbs->push($video->title, route('videos.index', $video->slug));
});

With:

Breadcrumbs::register('videos.show', function($breadcrumbs, $video) {
    $breadcrumbs->parent('videos.index');
    $breadcrumbs->push($video, route('videos.index', $video));
});

$video returns the 'slug'. Not throwing any errors, but rendering breadcrumbs like so:

Home / Videos / my-slug-string

Providers

'providers' => array(
    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    'Illuminate\Cache\CacheServiceProvider',
    'Illuminate\Session\CommandsServiceProvider',
    'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
    'Illuminate\Routing\ControllerServiceProvider',
    'Illuminate\Cookie\CookieServiceProvider',
    'Illuminate\Database\DatabaseServiceProvider',
    'Illuminate\Encryption\EncryptionServiceProvider',
    'Illuminate\Filesystem\FilesystemServiceProvider',
    'Illuminate\Hashing\HashServiceProvider',
    'Illuminate\Html\HtmlServiceProvider',
    'Illuminate\Log\LogServiceProvider',
    'Illuminate\Mail\MailServiceProvider',
    'Illuminate\Database\MigrationServiceProvider',
    'Illuminate\Pagination\PaginationServiceProvider',
    'Illuminate\Queue\QueueServiceProvider',
    'Illuminate\Redis\RedisServiceProvider',
    'Illuminate\Remote\RemoteServiceProvider',
    'Illuminate\Auth\Reminders\ReminderServiceProvider',
    'Illuminate\Database\SeedServiceProvider',
    'Illuminate\Session\SessionServiceProvider',
    'Illuminate\Translation\TranslationServiceProvider',
    'Illuminate\Validation\ValidationServiceProvider',
    'Illuminate\View\ViewServiceProvider',
    'Illuminate\Workbench\WorkbenchServiceProvider',
    'Way\Generators\GeneratorsServiceProvider',
    'DaveJamesMiller\Breadcrumbs\ServiceProvider'
)

Aliases

'aliases' => array(
    'App'             => 'Illuminate\Support\Facades\App',
    'Artisan'         => 'Illuminate\Support\Facades\Artisan',
    'Auth'            => 'Illuminate\Support\Facades\Auth',
    'Blade'           => 'Illuminate\Support\Facades\Blade',
    'Cache'           => 'Illuminate\Support\Facades\Cache',
    'ClassLoader'     => 'Illuminate\Support\ClassLoader',
    'Config'          => 'Illuminate\Support\Facades\Config',
    'Controller'      => 'Illuminate\Routing\Controller',
    'Cookie'          => 'Illuminate\Support\Facades\Cookie',
    'Crypt'           => 'Illuminate\Support\Facades\Crypt',
    'DB'              => 'Illuminate\Support\Facades\DB',
    'Eloquent'        => 'Illuminate\Database\Eloquent\Model',
    'Event'           => 'Illuminate\Support\Facades\Event',
    'File'            => 'Illuminate\Support\Facades\File',
    'Form'            => 'Illuminate\Support\Facades\Form',
    'Hash'            => 'Illuminate\Support\Facades\Hash',
    'HTML'            => 'Illuminate\Support\Facades\HTML',
    'Input'           => 'Illuminate\Support\Facades\Input',
    'Lang'            => 'Illuminate\Support\Facades\Lang',
    'Log'             => 'Illuminate\Support\Facades\Log',
    'Mail'            => 'Illuminate\Support\Facades\Mail',
    'Paginator'       => 'Illuminate\Support\Facades\Paginator',
    'Password'        => 'Illuminate\Support\Facades\Password',
    'Queue'           => 'Illuminate\Support\Facades\Queue',
    'Redirect'        => 'Illuminate\Support\Facades\Redirect',
    'Redis'           => 'Illuminate\Support\Facades\Redis',
    'Request'         => 'Illuminate\Support\Facades\Request',
    'Response'        => 'Illuminate\Support\Facades\Response',
    'Route'           => 'Illuminate\Support\Facades\Route',
    'Schema'          => 'Illuminate\Support\Facades\Schema',
    'Seeder'          => 'Illuminate\Database\Seeder',
    'Session'         => 'Illuminate\Support\Facades\Session',
    'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
    'SSH'             => 'Illuminate\Support\Facades\SSH',
    'Str'             => 'Illuminate\Support\Str',
    'URL'             => 'Illuminate\Support\Facades\URL',
    'Validator'       => 'Illuminate\Support\Facades\Validator',
    'View'            => 'Illuminate\Support\Facades\View',
    'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade'
)

Breadcrumbs Version: dev-master
Laravel Version: 4.2.6
PHP Version: 5.5.12

I hope I've provided you with everything you need 👍

Add arbitrary data to breadcrumbs

e.g. breadcrumbs.php:

$breadcrumbs->push($title, $url, ['icon' => 'sample.png']);

Custom template:

<img src="{{{ $breadcrumb->options['icon'] }}}">

Breadcrumbs and Ressources

Hi,
a short question:

I have named ressources in my controller, like this:

Route::resource('categories', 'CategoriesController',
[
'names' => ['index' => 'categories.index', 
            'create' => 'categories.create', 
            'show' => 'categories.show',
            'edit' => 'categories.edit',  
            'store' => 'categories.store', 
            'update' => 'categories.update', 
            'destroy' => 'categories.destroy']
]);

Is it possible to create a breadcrumb that displays as follows:
Home / Categories / Edit or Home /Categories / Delete in one function, or do the individual routes need to be created as individual breadcrumb entries? The question is especially of concern to me since I plan on localizing the URLs / routes of my application. For me, this works, but it seems clumsy:

Breadcrumbs::register('categories.index', function($breadcrumbs) {
    $breadcrumbs->parent('Home');
    $breadcrumbs->push('Categories', route('categories.index'));
});

Breadcrumbs::register('Categories', function($breadcrumbs) {
    $breadcrumbs->parent('Home');
    $breadcrumbs->push('Categories', route('categories.index'));
});

Breadcrumbs::register('categories.create', function($breadcrumbs) {
    $breadcrumbs->parent('Categories');
    $breadcrumbs->push('Create a Category', route('categories.create'));
});

Breadcrumbs::register('categories.edit', function($breadcrumbs) {
    $breadcrumbs->parent('Categories');
    $breadcrumbs->push('Edit', route('categories.edit'));
});

Best Regards, and please excuse my noobish question.

Wolf

(Edit: Second question became irrelevant, found a way)

[Request] Allow for breadcrumb items without links

For some items in a breadcrumb, there isn't actually a page for the hierarchy it represents, but we'd like to display it anyway just as text. At the moment, passing nothing to the second parameter in the push() method just generates an empty link.

I think it would be more fitting if passing no second parameter to the method means the crumb is displayed as simply text.

Do not throw exceptions for unnamed routes

Would it be possible to not throw exceptions if there are no named routes matching the current page/route?

For instance, for one of my modules I use Route::controller but when I output the breadcrumbs it throws an exception because it is unnamed. I would prefer it if it would simply output what it has so far (or nothing at all) rather than simply throwing an exception and thus terminating app execution.

Automatically determine breadcrumbs from current route

I don't yet know if this is possible but I'd like to try to determine the current breadcrumbs from the current route name & parameters, so that it's not necessary to specify these again in the view.

This may not be possible since not all routes are named...

Request to put "breadcrumbs.php" on "workbench" too.

Excuse me, that i ask again.
I would like to request you to put breadcrumbs.php on workbench\myvendor\mypackage\src and auto load it in boot method of service provider of workbench.
Because i want to put breadcrumbs direct in it's workbench.
In Laravel we can put routes.php and add it to boot method of service provicer in workbench too.
I think that, we are easy to manage breadcrumbs by workbench.

Exception when running on php 5.3.8

Hi Dave,

On my development environment works fine (php 5.4.x), but when I migrate the whole site to my hosting (php 5.3.8) shows up the following exception:

Argument 2 passed to DaveJamesMiller\Breadcrumbs\BreadcrumbsManager::register() must be an instance of DaveJamesMiller\Breadcrumbs\Callable, instance of Closure given, called in /usr/home/arquivomusicalgalego.com/web/arqv2/bootstrap/compiled.php on line 3321 and defined 

On the laravel error stack page I've found that the error appears on the first breadcrumb registry:

Breadcrumbs::register('dashboard', function($breadcrumbs) {
 $breadcrumbs->push(trans('breadcrumbs.dashboard'), route('dashboard'));
});

I haven't found any clue what my problem is. I only worry if it is something about going from php 5.4 to 5.3 (sintax problem).

Many thxs!

My breadcrumbs.php:

Breadcrumbs::register('dashboard', function($breadcrumbs) {
    $breadcrumbs->push(trans('breadcrumbs.dashboard'), route('dashboard'));
});

//*************** AUTHORS ***************//
Breadcrumbs::register('autores', function($breadcrumbs) {
    $breadcrumbs->parent('dashboard');
    $breadcrumbs->push(trans('breadcrumbs.authors'), route('dashboard.autores.index'));
});

Breadcrumbs::register('autoresEdit', function($breadcrumbs, $id) {
    $breadcrumbs->parent('autores');
    $breadcrumbs->push(trans('breadcrumbs.edit'), route('dashboard.autores.edit', $id));
});

Breadcrumbs::register('autoresCreate', function($breadcrumbs) {
    $breadcrumbs->parent('autores');
    $breadcrumbs->push(trans('breadcrumbs.create'), route('dashboard.autores.create'));
});

//*************** GENRES ***************//
Breadcrumbs::register('generos', function($breadcrumbs) {
    $breadcrumbs->parent('dashboard');
    $breadcrumbs->push(trans('breadcrumbs.genres'), route('dashboard.generos.index'));
});

Breadcrumbs::register('generosEdit', function($breadcrumbs, $id) {
    $breadcrumbs->parent('generos');
    $breadcrumbs->push(trans('breadcrumbs.edit'), route('dashboard.generos.edit', $id));
});

Breadcrumbs::register('generosCreate', function($breadcrumbs) {
    $breadcrumbs->parent('generos');
    $breadcrumbs->push(trans('breadcrumbs.create'), route('dashboard.generos.create'));
});

//*************** MATERIALS ***************//
Breadcrumbs::register('materiales', function($breadcrumbs) {
    $breadcrumbs->parent('dashboard');
    $breadcrumbs->push(trans('breadcrumbs.materials'), route('dashboard.materiales.index'));
});

Breadcrumbs::register('materialesEdit', function($breadcrumbs, $id) {
    $breadcrumbs->parent('materiales');
    $breadcrumbs->push(trans('breadcrumbs.edit'), route('dashboard.materiales.edit', $id));
});

Breadcrumbs::register('materialesCreate', function($breadcrumbs) {
    $breadcrumbs->parent('materiales');
    $breadcrumbs->push(trans('breadcrumbs.create'), route('dashboard.materiales.create'));
});

//*************** SCHOOLS ***************//
Breadcrumbs::register('centros', function($breadcrumbs) {
    $breadcrumbs->parent('dashboard');
    $breadcrumbs->push(trans('breadcrumbs.schools'), route('dashboard.centros.index'));
});

Breadcrumbs::register('centrosEdit', function($breadcrumbs, $id) {
    $breadcrumbs->parent('centros');
    $breadcrumbs->push(trans('breadcrumbs.edit'), route('dashboard.centros.edit', $id));
});

Breadcrumbs::register('centrosCreate', function($breadcrumbs) {
    $breadcrumbs->parent('centros');
    $breadcrumbs->push(trans('breadcrumbs.create'), route('dashboard.centros.create'));
});

//*************** FILES ***************//
Breadcrumbs::register('registros', function($breadcrumbs) {
    $breadcrumbs->parent('dashboard');
    $breadcrumbs->push(trans('breadcrumbs.files'), route('dashboard.registros.index'));
});

Breadcrumbs::register('registrosEdit', function($breadcrumbs, $id) {
    $breadcrumbs->parent('registros');
    $breadcrumbs->push(trans('breadcrumbs.edit'), route('dashboard.registros.edit', $id));
});

Breadcrumbs::register('registrosCreate', function($breadcrumbs) {
    $breadcrumbs->parent('registros');
    $breadcrumbs->push(trans('breadcrumbs.create'), route('dashboard.registros.create'));
});

//*************** USERS ***************//
Breadcrumbs::register('usuariosPropiedades', function($breadcrumbs) {
    $breadcrumbs->parent('dashboard');
    $breadcrumbs->push(trans('breadcrumbs.config'), route('dashboard.usuarios.config'));
});

And my routes.php

 /** ------------------------------------------
 *  Route model binding
 *  ------------------------------------------
 */
Route::model('user', 'User');
Route::model('autor', 'Autore');
Route::model('genero', 'Genero');
Route::model('material', 'Material');
Route::model('centro', 'Centro');

/** ------------------------------------------
 *  Dashboard Routes
 *  ------------------------------------------
 */

Route::group(array('prefix' => 'dashboard', 'before'=>'auth.sentry2'), function()
{
  // Dashboard
  Route::get('/', array('as' => 'dashboard', 'uses' => 'DashboardHomeController@getIndex'));

  // Authors management
  Route::get('autores/{criteria}/search', array('as' => 'dashboard.autores.search', 'uses' => 'DashboardAutoresController@getSearch'))
        ->where('criteria', '[a-z ñáéíóúA-Z]+');

  Route::bind('autores', function($id, $route){
    return Autore::with('user')->find($id);
  });
  Route::resource('autores', 'DashboardAutoresController');

  // Genres management
  Route::bind('generos', function($id, $route){
    return Genero::with('user')->find($id);
  });

  Route::get('generos/{criteria}/search', array('as' => 'dashboard.generos.search', 'uses' => 'DashboardGenerosController@getSearch'))
        ->where('criteria', '[a-z ñáéíóúA-Z]+');

  Route::resource('generos', 'DashboardGenerosController');

  // Materials management
  Route::bind('materiales', function($id, $route){
    return Material::with('user')->find($id);
  });

  Route::get('materiales/{criteria}/search', array('as' => 'dashboard.materiales.search', 'uses' => 'DashboardMaterialesController@getSearch'))
        ->where('criteria', '[a-z ñáéíóúA-Z]+');

  Route::resource('materiales', 'DashboardMaterialesController');

  // Materials management
  Route::bind('centros', function($id, $route){
    return Centro::with('user')->find($id);
  });

  Route::get('centros/{criteria}/search', array('as' => 'dashboard.centros.search', 'uses' => 'DashboardCentrosController@getSearch'))
        ->where('criteria', '[a-z ñáéíóúA-Z]+');

  Route::resource('centros', 'DashboardCentrosController');

  // Files management
  Route::bind('registros', function($id, $route){
    return Registro::with('user')->find($id);
  });
  Route::get('registros/{criteria}/search', array('as' => 'dashboard.registros.search', 'uses' => 'DashboardRegistrosController@getSearch'))
        ->where('criteria', '[a-z ñáéíóúA-Z]+');
  Route::resource('registros', 'DashboardRegistrosController');

  // User management
  Route::get('usuario/propiedades', array('as' => 'dashboard.usuarios.config', 'uses' => 'DashboardHomeController@getUserOptions'));
  Route::post('usuario/propiedades', array('as' => 'dashboard.usuarios.configStore', 'uses' => 'DashboardHomeController@postUserOptions'));

});

/** ------------------------------------------
 *  Frontend Routes
 *  ------------------------------------------
 */

// User RESTful Routes (Login, Logout, Register, etc)
Route::controller('users', 'UsersController', array('getLogin' => 'login', 'postLogin' => 'post.login','getLogout' => 'logout'));

Route::get('/', function()
{
  return Redirect::route('dashboard');
});

/** ------------------------------------------
 *  REST Services
 *  ------------------------------------------
 */
Route::get('rest/materiales', array('as' => 'rest.materiales.all', 'uses' => 'DashboardMaterialesController@getJasoned'));
Route::get('rest/autores', array('as' => 'rest.autores.all', 'uses' => 'DashboardAutoresController@getJasoned'));
Route::get('rest/generos', array('as' => 'rest.generos.all', 'uses' => 'DashboardGenerosController@getJasoned'));
Route::get('rest/centros', array('as' => 'rest.centros.all', 'uses' => 'DashboardCentrosController@getJasoned'));

Trying to get property of non-object (again)

This is really odd.

View

{{ Breadcrumbs::render('past-initiatives.show', $initiative) }}

breadcrumbs.php

Breadcrumbs::register('past-initiatives.show', function ($breadcrumbs, $initiative) {
    $breadcrumbs->parent('past-initiatives.index');
    $breadcrumbs->push(
        $initiative->title,
        route(
            'past-initiatives.show',
            ['slug' => $initiative->url]
        )
    );
});

If I do a dd($initiative) within register I get the full object

object(PastInitiative)#456 (21) {
  ["sluggable":protected] array(2) {
    ["build_from"] "title"
    ["save_to"] "url"
  }
  ["guarded":protected] array(3) {
    [0] "id"
    [1] "created_at"
    [2] "updated_at"
  }
  ...

However, I get this error within the ->push() call

http://i.imgur.com/2awFGC0.png

Doing something like $initiative->title within a dd the title is shown. It only seems to trigger when trying to use push.

Reloading the object within register works, however, I'd rather not have to load the model in again when I can just pass it from within the view.

Any idea what may be going on here or anything you can think of that I can do to get this to work.

Thanks

please help me.

My app structure

// app structure
app/
bootstrap/
....
workbench/
   theara/test/
            src/
               Theara/Test/TestServiceProvider.php
               breadcrumbs.php
               routes.php

And then

// in breadcrumbs.php
Breadcrumbs::register(
    'home',
    function ($breadcrumbs) {
        $breadcrumbs->push('Home', '#');
    }
);

// in Theara/Test/TestServiceProvider.php
public function boot()
    {
        $this->package('theara/test');
        include __DIR__ . '/../../routes.php';
        include __DIR__ . '/../../breadcrumbs.php';
    }

// in views (workbench/theara/test/src/views/bootstrap.blade.php)
.................
<div class="container">
    <?php echo Breadcrumbs::render('home'); ?>
</div>
..................

When i run

ErrorException
Illegal offset type in isset or empty (View: D:\wamp\www\laravel\workbench\theara\test\src\views\bootstrap.blade.php)
open: D:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php
     * Get the fully qualified location of the view.
     *
     * @param  string  $name
     * @return string
     */
    public function find($name)
    {
        if (isset($this->views[$name])) return $this->views[$name];

        if (strpos($name, '::') !== false)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.