77use App \Cliente ;
88use App \DividaDoCliente ;
99
10-
11-
1210class DividaController extends Controller
1311{
1412
@@ -18,19 +16,16 @@ public function __construct()
1816 }
1917 public function index ()
2018 {
21- $ dividas = (new Divida ())->paginate ( 2 )-> all ();
19+ $ dividas = (new Divida ())->all ();
2220
2321 return $ this ->view ('/dividas/index ' , [
2422 'dividas ' => $ dividas
2523 ]);
2624 }
2725
28-
29-
3026 public function create ()
3127 {
3228 $ clientes = (new Cliente ())->all ();
33-
3429 return $ this ->view ('/dividas/create ' );
3530 }
3631
@@ -40,7 +35,6 @@ public function store()
4035 $ divida ->valor = $ this ->request ()->input ('valor ' );
4136 $ divida ->vencimento = $ this ->request ()->input ('vencimento ' );
4237 $ divida ->save ();
43-
4438 $ this ->alert ('success ' , 'Dívida cadastrada com sucesso ! ' );
4539 return $ this ->route ()->redirect ('/dividas/edit ' );
4640 }
@@ -49,20 +43,17 @@ public function edit($id)
4943 {
5044 $ divida = (new Divida ())->find ($ id );
5145 $ clientes = (new Cliente ())->all ();
52-
53-
5446 return $ this ->view ('/dividas/edit ' , [
5547 'divida ' => $ divida ,
5648 'clientes ' => $ clientes
5749 ]);
58-
5950 }
6051
6152 public function show ($ id )
6253 {
6354 $ divida = (new Divida ())->find ($ id );
6455
65- return $ this ->view ('/dividas/edit ' , [
56+ return $ this ->view ('/dividas/show ' , [
6657 'divida ' => $ divida
6758 ]);
6859
@@ -72,7 +63,7 @@ public function update($id)
7263 {
7364 $ valor = $ this ->request ()->input ('valor ' );
7465 $ vencimento = $ this ->request ()->input ('vencimento ' );
75- $ divida (new Divida ())->find ($ id );
66+ $ divida = (new Divida ())->find ($ id );
7667 $ divida ->update ([
7768 'valor ' => $ valor ,
7869 'vencimento ' => $ vencimento
0 commit comments