mercredi 17 juillet 2019

Route issue:Class Controller does not exist in Laravel 5.8

I am creating a profile section. And Show.blade.php is the profile edit part.

But I cannot see show.blade.php.

I got a following error.

error image

Here is my code. web.php

Route::resource('channels', 'ChannelController');

php artisan route:list in terminal. And this is the result. php artisan route:list

app.blade.php once I click here I can jump to show.blade.php

<a class="dropdown-item" href=""> My Channel</a>

ChannelController.php

public function show(Channel $channel)
    {
        return view('channels.show', compact('channel'));
    }

Show.blade.php

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    
                </div>

                <div class="card-body">
                    <form id="update-channel-form" action="" method="POST" enctype="multipart/form-data">
                        @csrf

                        @method('PATCh')
                        <div class="form-group">   
                            <label for="name" class="form-control-label">
                                Name
                            </label>
                            <input id="name" name="name" value="" type="text" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="description" class="form-control-label">
                                Description
                            </label>
                            <textarea name="description" id="description" cols="3" rows="3" class="form-control">
                                
                            </textarea>
                        </div>

                        <button class="btn btn-info" type="submit">Update</button>

                    </form>

                </div>
            </div>
        </div>
    </div>
</div>
@endsection

I tried following things.

php artisan cache:clear

composer update

composer dump-autoload

php artisan db:seed

But still it doesn't work.

I am glad if someone helps me out.

I guess, I have something wrong with my route. This route also did not work.

Route::resource('channels', 'ChannelController')->name('channels.show');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire