PHP code example of batrox / laravel-views

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

    

batrox / laravel-views example snippets


  

  namespace App\Actions;

  use LaravelViews\Actions\Action;
  use LaravelViews\Views\View;          // new line

  class YourAction extends Action
  {
      public function renderIf($item, View $view)       // add the view parameter
      {
          // your content
      }
  }
  

/* Before */
public function repository(): Builder
{
    // You are using a single query
    return User::query();
}

/** After */
protected $model = User::class;