Segue a mensagem que estou recebendo no final destes exercícios.
Sorry, the page you are looking for could not be found.
1/1 NotFoundHttpException in RouteCollection.php line 161: in RouteCollection.php line 161 at RouteCollection->match(object(Request)) in Router.php line 821 at Router->findRoute(object(Request)) in Router.php line 691 at Router->dispatchToRoute(object(Request)) in Router.php line 675 at Router->dispatch(object(Request)) in Kernel.php line 246 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 44 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 at Pipeline->then(object(Closure)) in Kernel.php line 132 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99 at Kernel->handle(object(Request)) in index.php line 54 at require_once('C:\xampp\htdocs\estoque\public\index.php') in server.php line 21
Produto.Controller.php
<?php namespace estoque\Http\Controllers;
use Illuminate\Support\Facades\DB;
use Request;
class ProdutoController extends Controller {
public function lista (){
$produtos = DB::select('select * from produtos');
return view('produto.listagem')->with('produtos', $produtos);
}
public function mostra(){
$id = Request::route('id');
$resposta = DB::select('select * from produtos where id = ?', [$id]);
if (empty($resposta)) {
return "Esse produto não existe";
}
return view('produto.detalhes')->with('p', $resposta[0]);
}
public function novo(){
return view('produto.formulario');
}
public function adiciona(){
$nome = Request::input('nome');
$valor = Request::input('valor');
$quantidade = Request::input('quantidade');
$descricao = Request::input('descricao');
DB::insert('insert into produtos (nome, quantidade, valor, descricao)',
array($nome, $quantidade, $valor, $descricao));
return view('produto.adicionado')->with('nome', $nome);
}
}
formulario.blade.php
@extends('layout.principal')
@section('conteudo')
Novo produto
Nome
Quantidade
Valor
Descricao
@stop
adicionado.blade.php
@extends('layout.principal')
@section('conteudo')
Sucesso! O produto {{$nome}} foi adicionado!
@stop