PHP code example of redot / laravel-api-scaffold

1. Go to this page and download the library: Download redot/laravel-api-scaffold 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/ */

    

redot / laravel-api-scaffold example snippets


public function index()
{
    return $this->respond(
        payload: ['foo' => 'bar'],
        message: 'This is a message',
        status: 200
    );
}

public function index()
{
    return $this->fail(
        message: 'This is a message',
        status: 400,
        payload: ['foo' => 'bar']
    );
}

// Access settings using the model
Setting::get('foo');

// Or via the helper function
setting('foo');