File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 55$ config = require (base_path ('config.php ' ));
66$ db = new Database ($ config ['database ' ]);
77
8- $ heading = 'Create Note ' ;
8+ // $heading = 'Create Note';
9+ $ errors = [];
910
1011if ($ _SERVER ['REQUEST_METHOD ' ] === 'POST ' ) {
11- $ errors = [];
1212
1313 if (! Validator::string ($ _POST ['body ' ], 1 , 1000 )) {
1414 $ errors ['body ' ] = 'A body of no more than 1000 characters is required. ' ;
2323 }
2424}
2525
26- require base_path ('views/notes/create.view.php ' );
26+ // require base_path('views/notes/create.view.php');
27+ view ('notes/create.view.php ' , [
28+ 'heading ' => 'Create Note ' ,
29+ 'errors ' => $ errors
30+ ]);
Original file line number Diff line number Diff line change 33$ config = require (base_path ('config.php ' ));
44$ db = new Database ($ config ['database ' ]);
55
6- $ heading = 'Note ' ;
6+ // $heading = 'Note';
77$ currentUserId = 5 ;
88
99$ note = $ db ->query ('SELECT * FROM notes where id = :id ' , [
1313
1414authorize ($ note ['user_id ' ] === $ currentUserId );
1515
16- include base_path ('views/notes/show.view.php ' );
17-
16+ // include base_path('views/notes/show.view.php');
17+ view ('notes/show.view.php ' , [
18+ 'heading ' => 'Note ' ,
19+ 'note ' => $ note
20+ ]);
1821
1922// both is acceptable with : and without : no difference
2023// $notes = $db->query('SELECT * FROM notes where id = :id', ['id' => $id])->fetch();
You can’t perform that action at this time.
0 commit comments