PHP code example of staudenmeir / laravel-migration-views
1. Go to this page and download the library: Download staudenmeir/laravel-migration-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/ */
staudenmeir / laravel-migration-views example snippets
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
$query = DB::table('users')->where('active', true);
Schema::createView('active_users', $query);
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
$query = 'select id from users where active = 1';
Schema::createView('active_users', $query, ['key']);
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
$query = DB::table('users')->where('active', true);
Schema::createOrReplaceView('active_users', $query);
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
$query = DB::table('users')->where('active', true);
Schema::createView('active_users', $query, algorithm: 'TEMPTABLE');
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
Schema::renameView('active_users', 'users_active');
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
Schema::dropView('active_users');
Schema::dropViewIfExists('active_users');
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
if (Schema::hasView('active_users')) {
//
}
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
$columns = Schema::getViewColumnListing('active_users');
use Staudenmeir\LaravelMigrationViews\Facades\Schema;
$query = DB::table('users')->where('active', true);
Schema::createMaterializedView('active_users', $query);
Schema::refreshMaterializedView('active_users');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.