Git Product home page Git Product logo

Comments (9)

d13r avatar d13r commented on June 9, 2024

There is no Laravel 4.42 so I assume you mean 4.2?

Breadcrumbs 3 is only compatible with Laravel 5. Did you follow the instructions to install Breadcrumbs 2?

Is it installed correctly in the vendor/davejamesmiller/laravel-breadcrumbs/ directory?

from laravel-breadcrumbs.

khalid11 avatar khalid11 commented on June 9, 2024

Yes, I have Breadcrumb 2 invendor/davejamesmiller/laravel-breadcrumbs/
Directory also I follow all instructions.

from laravel-breadcrumbs.

d13r avatar d13r commented on June 9, 2024

Please provide the more detail as per https://github.com/davejamesmiller/laravel-breadcrumbs/blob/master/CONTRIBUTING.rst. Thanks

from laravel-breadcrumbs.

khalid11 avatar khalid11 commented on June 9, 2024

I follow each step which is given here:

https://github.com/davejamesmiller/laravel-breadcrumbs/tree/2.x

Do you want me to share my code setting which I did?

from laravel-breadcrumbs.

d13r avatar d13r commented on June 9, 2024

Yes, I want you to read the link - particularly the bit which starts "All support requests / bug reports should include the following:".

from laravel-breadcrumbs.

khalid11 avatar khalid11 commented on June 9, 2024

Here is the process which I follow in installation and setting:

  1. I run following command to install: composer require davejamesmiller/laravel-breadcrumbs:2.*
  2. After successful installation I put below code in app/config/app.php:
    'providers' => array(
        // ...
        'DaveJamesMiller\Breadcrumbs\ServiceProvider',
    ),

And:

    'aliases' => array(
        // ...
        'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',
    ),
  1. Then I have create a file call breadcrums.php in my app folder and put below code in breadcrums.php file:
<?php

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

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

Breadcrumbs::register('category', function($breadcrumbs, $category) {
    $breadcrumbs->parent('blog');

    foreach ($category->ancestors as $ancestor) {
        $breadcrumbs->push($ancestor->title, route('category', $ancestor->id));
    }

    $breadcrumbs->push($category->title, route('category', $category->id));
});

Breadcrumbs::register('page', function($breadcrumbs, $page) {
    $breadcrumbs->parent('category', $page->category);
    $breadcrumbs->push($page->title, route('page', $page->id));
});
  1. Then I create a view file in following path: `app/views/_partials/breadcrumbs.blade.php``` and put below code:
@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
  1. Then I add below code in my config app.php file:
'view' => '_partials.breadcrumbs',
  1. In final step I call Breadcrumb in my view file:
{{ Breadcrumbs::render('home') }}
{{ Breadcrumbs::render('category', $category) }}

But it give me Class 'DaveJamesMiller\Breadcrumbs\ServiceProvider' not found error.

Can you please guide me how I can fix the problem?

Thanks in advance.

from laravel-breadcrumbs.

d13r avatar d13r commented on June 9, 2024

I have added code blocks markers to your message to make it readable - please see here if you aren't familiar with Markdown: https://help.github.com/articles/github-flavored-markdown/

I assume you didn't add the following code literally, but added the service provider to the end of the existing array? Can you show the the actual code in full? Maybe just paste in the whole file (other than encryption key or other sensitive things?

    'providers' => array(
        // ...
        'DaveJamesMiller\Breadcrumbs\ServiceProvider',
    ),

Otherwise I can't see anything wrong.

Can you check what is in the file vendor/composer/autoload_namespaces.php?

Please also run these commands and paste the output:

composer status
composer show -i

from laravel-breadcrumbs.

willycamargo avatar willycamargo commented on June 9, 2024

I had the same problem.
I run: "composer update" and the problem was solved.

from laravel-breadcrumbs.

UjjavalMoradiya avatar UjjavalMoradiya commented on June 9, 2024

You need to comment the following line in config/app.php (and then uncomment once composer has done its thing).
DaveJamesMiller\Breadcrumbs\ServiceProvider::class,

I got to know about this solution from here and worked for me also.

from laravel-breadcrumbs.

Related Issues (20)

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.