PHP code example of thibaud-dauce / sql-view

1. Go to this page and download the library: Download thibaud-dauce/sql-view 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/ */

    

thibaud-dauce / sql-view example snippets




use ThibaudDauce\SQLView\Blueprint;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Migrations\Migration;

class AddUserView extends Migration {

  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
    SQLView::create('user-view', function($view) {

      $query = $view->newQuery('table')->where('id', new Expression(3));
      $view->setQuery($query);
    });
  }

  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
    SQLView::drop('user-view');
  }

}