DEV Community

Cover image for Tinker get first data & all
Asep Septiadi
Asep Septiadi

Posted on

Tinker get first data & all

Get First Data

> App\Models\Barang::first();
= App\Models\Barang {#6247
    id: 1,
    kode_barang: "PRD-G3921",
    nama_barang: "Pocky Chocolate Mix 5 Stick",
    kategori_barang: "Snack",
    harga: 3000,
    stock: 20,
    sisa: 18,
    created_at: "2023-10-31 13:15:09",
    updated_at: "2023-10-31 13:17:31",
  }
Enter fullscreen mode Exit fullscreen mode

Get All data

> App\Models\Barang::all();
= Illuminate\Database\Eloquent\Collection {#6240
    all: [
      App\Models\Barang {#6250
        id: 1,
        kode_barang: "PRD-G3921",
        nama_barang: "Pocky Chocolate Mix 5 Stick",
        kategori_barang: "Snack",
        harga: 3000,
        stock: 20,
        sisa: 18,
        created_at: "2023-10-31 13:15:09",
        updated_at: "2023-10-31 13:17:31",
      },
    ],
  }
Enter fullscreen mode Exit fullscreen mode

Top comments (0)