PHP code example of anthonyedmonds / laravel-db-views

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

    

anthonyedmonds / laravel-db-views example snippets


return DB::table('requests')
    ->select(...)
    ->leftJoin(...)
    ->where(...);

DB::table('my_view')
    ->whereExists(
        MyModel::query()
            ->forUser($user)
            ->whereColumn('my_view.id', '=', 'my_models.id'),
    )
    ->get();

protected function setUp(): void
{
    parent::setUp();
    
    $this->useDatabaseViews();
}