PHP code example of matt-daneshvar / rest

1. Go to this page and download the library: Download matt-daneshvar/rest 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/ */

    

matt-daneshvar / rest example snippets




use App\Task;
use MattDaneshvar\ResourceController\ResourceController;

class TasksController extends ResourceController
{
  protected $resource = Task::class;

  protected $rules = ['name' => '

Route::resource('tasks', 'TasksController');

Route::resource('tasks', 'TasksController', ['only' => ['index', 'show']]);

class TasksController extends ResourceController
{
  protected $resource = Task::class;

  protected $rules = ['name' => '

class TasksController extends ResourceController
{
  protected $resource = Task::class;

  protected $storeRules = ['name' => '

class TasksController extends ResourceController
{
  protected $resource = Task::class;

  protected $perPage = 10;
}

class TasksController extends ResourceController
{
  /**
   * The resource class name.
   *
   * @var string
   */
  protected $resource = '';

  /**
   * The number of models to return for pagination.
   *
   * @var int|null
   */
  protected $perPage = 20;

  /**
   * Path to all views for this controller (dot-separated path from views directory).
   *
   * @var string
   */
  protected $viewsPath = null;

  /**
   * Views for different resource actions.
   *
   * @var array
   */
  protected $views = [];

  /**
   * Validation rules.
   *
   * @var array
   */
  protected $rules = [];

  /**
   * Validation rules for store action.
   *
   * @var array
   */
  protected $storeRules = null;

  /**
   * Validation rules for update action.
   *
   * @var array
   */
  protected $updateRules = null;
}