47 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
use Illuminate\Database\Capsule\Manager as Capsule;
 | 
						|
use Illuminate\Database\Schema\Builder;
 | 
						|
use Illuminate\Container\Container;
 | 
						|
use Itguild\EloquentTable\EloquentDataProvider;
 | 
						|
use Itguild\Tables\ListJsonTable;
 | 
						|
 | 
						|
ini_set("display_errors", true);
 | 
						|
error_reporting(-1);
 | 
						|
 | 
						|
require_once __DIR__ . "/vendor/autoload.php";
 | 
						|
 | 
						|
echo "<link rel='stylesheet' href='/vendor/twbs/bootstrap/dist/css/bootstrap.css'>";
 | 
						|
 | 
						|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
 | 
						|
$dotenv->load();
 | 
						|
 | 
						|
$capsule = new Capsule;
 | 
						|
$capsule->addConnection([
 | 
						|
    'driver' => $_ENV['DB_DRIVER'],
 | 
						|
    'host' => $_ENV['DB_HOST'],
 | 
						|
    'database' => $_ENV['DB_NAME'],
 | 
						|
    'username' => $_ENV['DB_USER'],
 | 
						|
    'password' => $_ENV['DB_PASSWORD'],
 | 
						|
    'charset' => $_ENV['DB_CHARSET'],
 | 
						|
    'collation' => $_ENV['DB_COLLATION'],
 | 
						|
    'prefix' => $_ENV['DB_PREFIX'],
 | 
						|
]);
 | 
						|
// Setup the Eloquent ORM…
 | 
						|
 | 
						|
$capsule->setAsGlobal();
 | 
						|
 | 
						|
$capsule->bootEloquent();
 | 
						|
 | 
						|
$schema = $capsule->schema();
 | 
						|
 | 
						|
$dataProvider = new EloquentDataProvider(\Itguild\EloquentTable\models\User::class, [
 | 
						|
    'currentPage' => 1,
 | 
						|
    'perPage' => 3,
 | 
						|
    'params' => ["class" => "table table-bordered", "border" => "2"],
 | 
						|
    'baseUrl' => "/admin/user",
 | 
						|
]);
 | 
						|
$table = new ListJsonTable($dataProvider->getJson());
 | 
						|
 | 
						|
$table->addAction(\Itguild\Tables\ActionColumn\EditActionColumn::class);
 | 
						|
$table->create();
 | 
						|
$table->render(); |