diff --git a/index.php b/index.php index 16bb4c4..7fd6e4c 100644 --- a/index.php +++ b/index.php @@ -5,6 +5,8 @@ use Illuminate\Container\Container; use Itguild\EloquentTable\EloquentDataProvider; use Itguild\EloquentTable\ListEloquentTable; use Itguild\EloquentTable\models\User; +use Itguild\EloquentTable\ViewEloquentTable; +use Itguild\EloquentTable\ViewJsonTableEloquentModel; use Itguild\Tables\ActionColumn\EditActionColumn; use Itguild\Tables\ListJsonTable; @@ -50,3 +52,13 @@ try { } catch (Exception $e) { } +//try { +// $table = new ViewEloquentTable(new ViewJsonTableEloquentModel(User::find(1), [ +// 'params' => ["class" => "table table-bordered", "border" => "2"], +// 'baseUrl' => "/admin/user", +// ])); +// $table->create(); +// $table->render(); +//} catch (Exception $e) { +//} + diff --git a/src/ViewEloquentTable.php b/src/ViewEloquentTable.php new file mode 100644 index 0000000..9a84868 --- /dev/null +++ b/src/ViewEloquentTable.php @@ -0,0 +1,25 @@ +dataProvider = $dataProvider; + parent::__construct($this->dataProvider->getJson()); + } + +} \ No newline at end of file diff --git a/view.php b/view.php new file mode 100644 index 0000000..6267b38 --- /dev/null +++ b/view.php @@ -0,0 +1,45 @@ +"; + +$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(); + +try { + $table = new ViewEloquentTable(new ViewJsonTableEloquentModel(User::find(1), [ + 'params' => ["class" => "table table-bordered", "border" => "2"], + 'baseUrl' => "/admin/user", + ])); + $table->create(); + $table->render(); +} catch (Exception $e) { +} +