1
I’m making a system using the Laravel 5.6
I climbed to a server I have and access this externally
But I’m having problems when the route uses the resouce, for example:
Route::resource('materiais', 'MaterialController');
The routes I created normal using Route::get
, Route::post
, Route::patch
, etc.. they work properly
For example if I’m in
http://192.168.0.23/sisobras/public/novaordem
and go to open a new order it follows to the address
http://192.168.0.23/sisobras/public/ordemservico/2/create?
working properly, the route is like this:
Route::get('ordemservico/{id}/create', 'OrdemServicoController@create');
but whether I’m in
http://192.168.0.23/sisobras/public/materiais
and I’ll register new material the url is like this:
http://192.168.0.23/materiais/create
Call function looks like this:
public function create()
{
$unidades = Unidade::all();
return view('materiais.create', compact('unidades'));
}
And the order of service so:
public function create($id)
{
if($id == 0){
$setores_internos = SetorInterno::all();
//$setores = Setor::where('setor_id', 5)->get();
$meios = Meio::all();
$bairros = Bairro::all();
$servicos = CadastroServico::where('setor_id', 5)->get();
date_default_timezone_set('America/Sao_Paulo');
$data = date('d/m/Y H:i:s');
return view('ordemservicos.create',compact('data','id','setores_internos','meios',$
}else{
$cidadao = Cidadao::find($id);
$meios = Meio::all();
$servicos = CadastroServico::whereNotIn('setor_id', [5])->get();
$enderecos = Endereco::where('cidadao_id', $id)->get();
$setores = Setor::whereNotIn('id', [5])->get();
$horas_servico = ConvertTime::convertToTime($cidadao->horas_servico);
date_default_timezone_set('America/Sao_Paulo');
$data = date('d/m/Y H:i:s');
return view('ordemservicos.create',compact('cidadao','meios','servicos','setores',$
}
}
and the lack of sisobras/public/
of a mistake of Not Found
When I use the system with the php artisan serve
running on the same machine works all correctly
The routes created qnd vc uses Resource are also named, vc is using their name in the link you click to go pro
/materiais/create
? If you don’t know the name, you can use Artisanphp artisan route:list
and check the route name and then on your link, put{{ route('nomeDaRota') }}
– Morkhusz
@morkhusz forwarding is done by the controller not in the link. The question is not this, because as I said there the route created normally works, if you create your own routes of Resource only that "open" it works correctly. But with Resource it removes the /sisobras/public
– Mateus