1. Create controller
Http >> Controllers >> WorkOrderController.php
2. Create Model
WorkOrder.php
Make sure class name is WorkOrder not Author.
3. Add routes
routes >> web.php
$router->get('workorders', ['uses' => 'WorkOrderController@showAllWorkOrders']);
$router->get('workorders/{id}', ['uses' => 'WorkOrderController@showOneWorkOrder']);
$router->post('workorders', ['uses' => 'WorkOrderController@create']);
$router->delete('workorders/{id}', ['uses' => 'WorkOrderController@delete']);
$router->put('workorders/{id}', ['uses' => 'WorkOrderController@update']);
4. Make sure your database (matthew_schema according to .env file) has 'work_orders' table. If model name is WorkOrder, system looks for work_orders. If model name is Author it looks for authors table.
5. Copy 1200 rows from browser to ember project /api/json file.
/Users/inheeoh/work/sydney-camera-repair/public/api/workorders.json
6. Ember routes will filter only this year's tasks.
7. it shows on website.
No comments:
Post a Comment