Skip to content
Patrick Samson edited this page Oct 15, 2015 · 1 revision

Next Steps

Now, if you go to http://localhost/datagrid in your browser, you should see an empty Datagrid!

But you probably want to add some data to it. Currently, the GetApiResponse() function in the DatagridController isn't returning anything. Replace it with this :

public function getApiResponse()
{
    return response()->json([
        'data' => [
            ['id' => 1, 'name' => 'Declan Kihn', 'email' => '[email protected]', 'created_at' => '2001-12-11T03:20:32+00:00'],
            ['id' => 2, 'name' => 'Kamron Carter', 'email' => '[email protected]', 'created_at' => '1999-01-11T03:20:32+00:00'],
            ['id' => 3, 'name' => 'Declan Huel', 'email' => '[email protected]', 'created_at' => '2004-12-22T03:20:32+00:00'],
        ],
    ]);
}

Refresh the page in your browser and you should see the data.

I recommend another of my packages, Laravel Api Response, along with a great package from The PHP League named Fractal to easily build and manage your API.

Clone this wiki locally