jackoftraits / laravel8-with-livewire

The official repo of a youtube video series in building simple content management system (CMS) using laravel 8 and livewire.
72 stars 51 forks source link

Unable to resolve dependency #1

Open arttohems opened 4 years ago

arttohems commented 4 years ago

After going through your tutorial, I wanted to check it against repo's code. After installing, it has this error.

Illuminate\Contracts\Container\BindingResolutionException
Unable to resolve dependency [Parameter #0 [ <required> $urlslug ]] in class App\Http\Livewire\Frontpage

STACKTRACE COMMENT

Illuminate\Container\BoundMethod::addDependencyForCallParameter
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:180

I'm not quite sure how to resolve it.

jackoftraits commented 4 years ago

After going through your tutorial, I wanted to check it against repo's code. After installing, it has this error.

Illuminate\Contracts\Container\BindingResolutionException
Unable to resolve dependency [Parameter #0 [ <required> $urlslug ]] in class App\Http\Livewire\Frontpage

STACKTRACE COMMENT

Illuminate\Container\BoundMethod::addDependencyForCallParameter
vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:180

I'm not quite sure how to resolve it.

Hi arttohems! You can try these steps.

1.) Delete the composer.lock file. 2.) Run "composer install" again. 3.) Check the routes/web.php and make sure you import the Frontpage class.

use App\Http\Livewire\Frontpage; ......

Route::get('/{urlslug}', Frontpage::class); Route::get('/', Frontpage::class);

Thanks! Let me know if you're still having issues!

arttohems commented 4 years ago

It did not fix anything.

jackoftraits commented 4 years ago

Hi Adam!

For now, don't worry about that error that you see on the front page. Since we added the

Route::get('/{urlslug}', Frontpage::class);

our home page expects a parameter that ideally matches the ones that we have in the database.

/**

We will cover this part in the next video on our youtube series 👇👇👇 https://www.youtube.com/playlist?list=PLSP81gW0XjNHk2D2NREM8A80xWO19Yulj

In the meantime, just go directly to the 👇👇👇 http://localhost:8000/login

and follow the rest of the video.

Thank you so much! Kudos and keep coding!

All the best, Jack of Traits

On Thu, Nov 5, 2020 at 10:31 AM Adam Hopper notifications@github.com wrote:

It did not fix anything.

[image: SIGNATURE.png] https://art-hems.com

[image: Artboard 3 copy 2.png] https://www.linkedin.com/in/arttohems/ [image: Artboard 3 copy.png] https://www.facebook.com/adamthertist [image: Artboard 3 copy 3.png] https://www.quora.com/profile/Adam-Hopper-6

Adam Hopper

Art to Hems

Creative Designer

C: 714.643.1321 <+17146431321>

E: adam@art-hems.com

O: art-hems.com

On Wed, Nov 4, 2020 at 4:41 PM Jack of Traits notifications@github.com wrote:

After going through your tutorial, I wanted to check it against repo's code. After installing, it has this error.

Illuminate\Contracts\Container\BindingResolutionException Unable to resolve dependency [Parameter #0 [ $urlslug ]] in class App\Http\Livewire\Frontpage

STACKTRACE COMMENT

Illuminate\Container\BoundMethod::addDependencyForCallParameter vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:180

I'm not quite sure how to resolve it.

Hi arttohems! You can try these steps.

1.) Delete the composer.lock file. 2.) Run "composer install" again. 3.) Check the routes/web.php and make sure you import the Frontpage class.

use App\Http\Livewire\Frontpage; ......

Route::get('/{urlslug}', Frontpage::class); Route::get('/', Frontpage::class);

Thanks! Let me know if you're still having issues!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/jackoftraits/laravel8-with-livewire/issues/1#issuecomment-722053204 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEI5VGKMHLDTTJMDUZYJBZDSOHYCFANCNFSM4TKU37CQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jackoftraits/laravel8-with-livewire/issues/1#issuecomment-722086477, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4STDF44TXNAN7MXM6HBPDSOIE7TANCNFSM4TKU37CQ .

Akmalkhan786 commented 3 years ago

Hi @arttohems , The issue is due to not passing the value to parameter "$urlslug" of livewire mount function. Pass the value like that: public function mount($urlslug = null) { $this->retrieveContent($urlslug); } Thanks