0
votes

My proses.blade.php is like this :

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

My routes\web.php is like this :

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

Route::get('perekamans/proses', ['uses' => 'PerekamanController@listdata']);

My PerekamanController is like this :

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

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 App\Http\Controllers\PerekamanController::show() does not exist

in Route.php line 333
at ReflectionMethod->__construct('App\Http\Controllers\PerekamanController', 'show') in Route.php line 333
at Route->signatureParameters('Illuminate\Database\Eloquent\Model') 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

3
First, public should be your root directory, and not displayed in the URL - Derek Pollard
Second, nowhere in your routes do you define proses as a route. - Derek Pollard
Nor do you define perekaman/proses - Derek Pollard
And the new error is telling you that the method show() does not exist on PerekamanController - Derek Pollard
Error is about myController, where is it? - Antonio Carlos Ribeiro

3 Answers

2
votes

you make mistake at your route:

Route::get('perekamans/proses', ['uses' => 'PerekamanController@listdata']);

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', 'PerekamanController@listdata');

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

0
votes

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 
0
votes

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