oktatas:web:back-end_framework:laravel:laravel_rest_api:eloquent
Tartalomjegyzék
Laravel - Eloquent
- Szerző: Sallai András
- Copyright © Sallai András, 2023
- Web: https://szit.hu
Az összes dolgozó lekérdezése
- app/Http/Controllers/EmployeeController.php
public function index() { return Employee::all(); }
Lapozás
public function index() { return Employee::paginate(); }
{ "current_page": 1, "data": [ { "id": 1, "name": "Gele Pál", "city": "Szolnok", "salary": "359.00", "created_at": "2022-04-17T09:29:09.000000Z", "updated_at": "2022-04-17T09:29:09.000000Z" }, { "id": 3, "name": "Nyers Imre", "city": "Szolnok", "salary": "350.00", "created_at": "2022-04-17T09:42:30.000000Z", "updated_at": "2022-04-19T11:03:26.000000Z" }, { "id": 27, "name": "Apró Béla", "city": "Szolnok", "salary": "333.00", "created_at": "2022-04-21T08:53:59.000000Z", "updated_at": "2022-04-21T09:58:55.000000Z" }, { "id": 31, "name": "Penge Elemér", "city": "Hatvan", "salary": "350.00", "created_at": "2022-04-22T12:58:09.000000Z", "updated_at": "2022-04-22T12:58:09.000000Z" }, { "id": 39, "name": "Trombita László", "city": "bbb", "salary": "333.00", "created_at": "2022-04-22T18:26:35.000000Z", "updated_at": "2022-04-22T19:57:43.000000Z" }, { "id": 40, "name": "Tenger Ádám", "city": "Szeged", "salary": "555.00", "created_at": "2022-04-22T18:27:57.000000Z", "updated_at": "2022-04-22T19:17:27.000000Z" }, { "id": 43, "name": "ggggg", "city": "bbb", "salary": "333.00", "created_at": "2022-04-22T19:54:56.000000Z", "updated_at": "2022-04-22T21:03:05.000000Z" }, { "id": 44, "name": "bbbbbbbbbbbb", "city": "bbbbbbbbbbbb", "salary": "333.00", "created_at": "2022-04-22T19:56:28.000000Z", "updated_at": "2022-04-22T19:56:28.000000Z" }, { "id": 48, "name": "bcbcbc", "city": "bbb", "salary": "333.00", "created_at": "2022-04-22T23:23:18.000000Z", "updated_at": "2022-04-23T06:25:54.000000Z" } ], "first_page_url": "http:\/\/localhost:8000\/api\/employees?page=1", "from": 1, "last_page": 1, "last_page_url": "http:\/\/localhost:8000\/api\/employees?page=1", "links": [ { "url": null, "label": "« Previous", "active": false }, { "url": "http:\/\/localhost:8000\/api\/employees?page=1", "label": "1", "active": true }, { "url": null, "label": "Next »", "active": false } ], "next_page_url": null, "path": "http:\/\/localhost:8000\/api\/employees", "per_page": 15, "prev_page_url": null, "to": 9, "total": 9 }
oktatas/web/back-end_framework/laravel/laravel_rest_api/eloquent.txt · Utolsó módosítás: 2023/05/15 21:43 szerkesztette: admin