PHP code example of weward / laramacro

1. Go to this page and download the library: Download weward/laramacro library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

weward / laramacro example snippets


'providers' => [

    // ...

    App\Providers\LaraMacroServiceProvider::class,
]



// Pass normal payload and http status
return response()->jsonApi($data, 200);

// Pass a Resource and hhtp status
return response()->jsonApi(new UserResource($data), 200);

bash
php artisan vendor:publish --tag=laramacro-providers