0
Giving my system the error below in Laravel 5.4. What may be causing this error?
I’ve reviewed and I’ve run the remote: php artisan clear-compiled
Follows parts of the code and its classes.
prefecture.blade.php
<h2> Lista de prefeituras</h2>
@if ( !isset($criterio) )
{{ $criterio = 'A'}}
@endif
@foreach(range('A', 'Z') as $letra)
<div class="btn-group" style="width: 39px">
<a href="{{ route('prefeituras.search',$letra) }}" class="btn btn-primary {{$letra === $criterio ? 'disabled' : '' }}" >
{{ $letra }}
</a>
</div>
@endforeach
Prefeituracontroller.php
public function search(Request $request, $criterio = null) {
//var_dump($letras);
if ( $criterio == null){
$criterio = 'A';
}
//var_dump($criterio);
$prefeituras = Prefeitura::indexSearch($criterio);
return view('prefeituras', compact('prefeituras', 'criterio'))
->with('i', ($request->input('page', 1) - 1) * 5);
}
web php.
//Prefeitura
//Route::get('prefeiturassearch/{letra}','PrefeituraController@search');
Route::get('prefeituras/{letra}',[
'as' => 'prefeituras.search',
'uses' => 'PrefeituraController@search']);
Route::resource('prefeituras','PrefeituraController');
Rafael, you need to post all relevant parts of the file
PrefeituraController.php
, that includes his statement, just remove the methods that are dispensable.– Jéf Bueno
it is good to check the file namespace
– 13dev
Rafael tries on the line of viww where it is written {{route('prefecturas.search',$letra)}} put {{route('prefeituras.search',['letra'=>$letra])}} if it works out it gives a hello for me to answer because it can be useful for someone. Thank you!
– Marcos da Cruz Sibilio Jr.
You should check the namespace to see if it is in accordance with Routeserviceprodiver. Check the namespace in the class itself. Check the file name. Check the routename in the action that goes in the route file (looks right). Comment on Resource there, it will probably give conflict. Put a prefix on this Source to avoid problems, or better, create a route file for the backend and arrow it in Routeserviceprovider.
– cau