File tree Expand file tree Collapse file tree 8 files changed +27
-21
lines changed
Expand file tree Collapse file tree 8 files changed +27
-21
lines changed Original file line number Diff line number Diff line change 44
55use SimpleORM \core \controller \Controller ;
66
7- class UsuariosController extends Controller
7+ class UsersController extends Controller
88{
99
1010 public function index ()
1111 {
1212 return ['texto ' => 'teste ' ];
1313 }
1414
15- public function listar ()
15+ public function get ()
1616 {
17- $ result = $ this ->Usuarios ->find ();
17+ $ result = $ this ->Users ->find ();
1818
19- return ['listagem ' => $ this ->Helper ->json ($ result )];
19+ return ['list ' => $ this ->Helper ->json ($ result )];
2020 }
2121}
Original file line number Diff line number Diff line change 22
33namespace SimpleORM \app \model ;
44
5- require_once CORE . 'model ' . DS . 'Model.php ' ;
65use SimpleORM \core \model \Model ;
76
87class AppModel extends Model
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace SimpleORM \app \model ;
4+
5+ use SimpleORM \app \model \AppModel ;
6+
7+ class Users extends AppModel
8+ {
9+ protected $ table = 't_user ' ;
10+ protected $ pk = 'user_id ' ;
11+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <?php echo $ list ;
File renamed without changes.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 77define ('APP ' , __DIR__ . DS . 'app ' . DS );
88define ('CORE ' , __DIR__ . DS . 'core ' . DS );
99
10+ require_once CORE . 'model ' . DS . 'Model.php ' ;
1011require_once CORE . 'controller ' . DS . 'Controller.php ' ;
1112use SimpleORM \app \controller ;
1213
2829 $ src = explode ('/ ' , $ uri );
2930 $ model = ucfirst ($ src [1 ]);
3031 $ controller = $ model .'Controller ' ;
31- $ method = (isset ($ src [2 ])) ? $ src [2 ] : 'index ' ;
32+ $ method = (isset ($ src [2 ])) ? $ src [2 ] : 'index ' ;
3233
3334 if (isset ($ src [3 ]) && empty ($ the_request )) {
3435 $ the_request = filter_var ($ src [3 ], FILTER_SANITIZE_STRING );
3536 }
3637
38+ /*
39+ * AppModel file
40+ */
41+ $ app_model = APP . 'model ' . DS .'AppModel.php ' ;
42+
43+ if (file_exists ($ app_model )) {
44+ require_once $ app_model ;
45+ }
3746 /*
3847 * require files of current Model/Controller
3948 */
40- $ model_file = __DIR__ . DS . ' app ' . DS . ' model ' . DS . $ model .'.php ' ;
49+ $ model_file = APP . ' model ' . DS . $ model .'.php ' ;
4150
4251 if (file_exists ($ model_file )) {
4352 require_once $ model_file ;
4453 }
45-
4654 /*
4755 * call current class/method
4856 */
You can’t perform that action at this time.
0 commit comments