Code Monkey home page Code Monkey logo

Comments (14)

balping avatar balping commented on September 2, 2024

Hello

What version of Laravel do you use?

Does it work with the show method?

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

I am using 5.5 and I am using the show method, that's where it gives me error. Also gives error on edit method with public function edit(Task $task)

from laravel-hashslug.

balping avatar balping commented on September 2, 2024

How does the relevant part of your route file look like?

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

Here is how:

image

Here is complete method:

    // edit page
    public function edit(Task $task)
    {
        title('Edit Task');

        return view('task::pages.task.edit', compact('task'));
    }

from laravel-hashslug.

balping avatar balping commented on September 2, 2024

Are you using Route::resource ?

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

That's true.

from laravel-hashslug.

balping avatar balping commented on September 2, 2024

Is the SubstituteBindings middleware loaded?

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

How can i verify that ? I only added use HasHashSlug; to my model, did nothing else.

from laravel-hashslug.

balping avatar balping commented on September 2, 2024

One way to make it sure is putting a dummy echo or dd() to the handle method of vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

Yes it is being called when i put dd there.

from laravel-hashslug.

balping avatar balping commented on September 2, 2024

Then I honestly have no idea, it's some laravel weirdness, maybe some interference with laravel modules.

Use this format, this will work for sure:

public function show($slug){
    $task = Task:findBySlugOrFail($slug);
}

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

No problem, thanks, yes maybe laravel modules package is doing something weiried. FYI, I was using this package in my laravel starter here: https://github.com/sarfraznawaz2005/laravel55-starter

Maybe you should try on fresh installation of Laravel 5.5, could be issue with 5.5.

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

Verified that it works with fresh installation of Laravel, so some other package I am using is doing the trick. Thanks for your help anyways.

from laravel-hashslug.

sarfraznawaz2005 avatar sarfraznawaz2005 commented on September 2, 2024

Found out, I was using FakeID package previously: https://github.com/Propaganistas/Laravel-FakeId and I forgot to remove its service provider registration. Thanks

from laravel-hashslug.

Related Issues (9)

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.