How to resolve : ReflectionException in Route.php line 333: Method AppHttpControllersPerekamanController::show() does not exist” in Laravel 5.3?

My proses.blade.php is like this :

<form method="POST" action="{{ url('/perekamans/proses') }}">
    {!! csrf_field() !!}
    ...
</form>

My routesweb.php is like this :
Route::resource('perekamans', 'PerekamanController');

Route::get('perekamans/proses', ['uses' => '<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cb9baeb9aea0aaa6aaa588a4a5bfb9a4a7a7aeb98ba7a2b8bfafaabfaa">[email protected]</a>']);

My PerekamanController is like this :
<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;

class PerekamanController extends Controller
{
    public function index(Request $request)
    {
        return view('perekamans.index');
    }

    public function listData()
    {
        return view('perekamans.show');
    }
}

My show.blade.php is like this :
@extends('layouts.app')

@section('content')

    <section class="content-header">
        <h1 class="pull-left">PEREKAMAN DATA</h1>
    </section>
    <div class="content">
        <div class="clearfix"></div>

        @include('flash::message')

        <div class="clearfix"></div>
        <div class="box box-primary">
            <div class="box-body">
                    @include('perekamans.table')
            </div>
        </div>
    </div>
@endsection

I call from url like this : http://localhost/mysystem/public/perekaman/proses

There exist error like this :

Whoops, looks like something went wrong.
1/1 ReflectionException in Route.php line 333: Method AppHttpControllersPerekamanController::show() does not exist

in Route.php line 333
at ReflectionMethod->__construct('AppHttpControllersPerekamanController', 'show') in Route.php line 333
at Route->signatureParameters('IlluminateDatabaseEloquentModel') in Router.php line 789

It looks like my code is correct, but why it is still an error?

Is there any solution to solve my problem?

Update :

Sorry, I can not answer all your questions. every time I write a comment to answer questions with you, and then click the comment button, it can not. there exist message :
question eligible for bounty in 2 days
so you immediately provide any solution

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

you make mistake at your route:

Route::get('perekamans/proses', ['uses' => '<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="326257405759535f535c715d5c46405d5e5e5740725e5b414656534653">[email protected]</a>']);

Route::resource('perekamans', 'PerekamanController');

Change the sequence become like that.

And one more thing at Laravel you can make it simpler.

Route::get('perekamans/proses', '<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="eebe8b9c8b858f838f80ad81809a9c8182828b9cae82879d9a8a8f9a8f">[email protected]</a>');

you don’t need to use uses to set which controller it will use

Method 2

Your controller is missing all of the resource methods (index, create, store, show, etc..). You need all of the methods mentioned in the documentation in the “actions” column.

Its a good idea to use artisan to scaffold your controller when you plan on using resource controllers:

php artisan make:controller --resource PerekamanController

Method 3

Add show() method in your PerekamanController.
Your route seem to be strange and that might be not work well . So make sure that your Http Webserver Rewrite is open.

If you use Apache,open your mod_rewrite and try this code in your .htaccess file

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

If Nginx,try this in your config file
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Hope this would help you


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x