1. Membuat Controller :

    php spark make:controller PegawaiController -restful

    Hasilnya :

class PegawaiController extends ResourceController
{
    /**
     * Return an array of resource objects, themselves in array format
     *
     * @return mixed
     */
    public function index()
    {
        //
    }


    /**
     * Return the properties of a resource object
     *
     * @return mixed
     */
    public function show($id = null)
    {
        //
    }


    /**
     * Return a new resource object, with default properties
     *
     * @return mixed
     */
    public function new()
    {
        //
    }


    /**
     * Create a new resource object, from "posted" parameters
     *
     * @return mixed
     */
    public function create()
    {
        //
    }


    /**
     * Return the editable properties of a resource object
     *
     * @return mixed
     */
    public function edit($id = null)
    {
        //
    }


    /**
     * Add or update a model resource, from "posted" properties
     *
     * @return mixed
     */
    public function update($id = null)
    {
        //
    }


    /**
     * Delete the designated resource object from the model
     *
     * @return mixed
     */
    public function delete($id = null)
    {
        //
    }

2. Selanjutnya Isi dulu data Mysql


  3.Tuliskan Sintack pada PegawaiController.php


4. Tambahkan Routes PegawaiController
    - Buka Routes dan tambahkan Roues PegawaiController sbb:
   

5. Instal Aplikasi Postman 
    - Untuk mebaca tabel yg telah dibuat di dalam mysql



               5. Membuat Read di Postman 

              - Method : GET
              - URL: http://localhost:8080/pegawai
              - Hasilnya sbb:

{
    "message""success",
    "data_pegawai": [
        {
            "id""3",
            "nama""Andre Taulani",
            "jabatan""Staf it",
            "bidang""Teknologi",
            "alamat""Kebayoran Lama",
            "email""andretw@gmail.com",
            "created_at""2022-12-29 02:00:11",
            "updated_at""2022-12-29 03:03:17"
        },
        {
            "id""2",
            "nama""Andre Taulani",
            "jabatan""Staf it",
            "bidang""Teknologi",
            "alamat""Kebayoran Lama",
            "email""andretw@gmail.com",
            "created_at""2022-12-29 14:25:36",
            "updated_at""2022-12-29 03:03:17"
        },
        {
            "id""1",
            "nama""Andre Taulani",
            "jabatan""Staf it",
            "bidang""Teknologi",
            "alamat""Kebayoran Lama",
            "email""andretw@gmail.com",
            "created_at""2022-12-29 13:00:01",
            "updated_at""2022-12-29 03:03:17"
        }
    ]
}