"; $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 ListEloquentTable(new EloquentDataProvider(User::class, [ 'currentPage' => 1, 'perPage' => 3, 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/user" ])); $table->columns([ 'created_at' => function ($data) { if (!$data){ return null; } return (new DateTimeImmutable($data))->format("d-m-Y"); }, 'updated_at' => function ($data) { if (!$data){ return null; } return (new DateTimeImmutable($data))->format("d-m-Y"); } ]); $table->addAction(EditActionColumn::class); $table->create(); $table->render(); } catch (Exception $e) { } try { $table = new ViewEloquentTable(new ViewJsonTableEloquentModel(User::find(1), [ 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/user", ])); $table->rows([ 'created_at' => function ($data) { if (!$data){ return null; } return (new DateTimeImmutable($data))->format("d-m-Y"); }, 'updated_at' => function ($data) { if (!$data){ return null; } return (new DateTimeImmutable($data))->format("d-m-Y"); } ]); $table->create(); $table->render(); } catch (Exception $e) { }