From 9e4357eb4fb98e96eaf3e3d89c585ce6d1d730a9 Mon Sep 17 00:00:00 2001 From: Julian Prieber <60265788+JulianPrieber@users.noreply.github.com> Date: Fri, 20 Oct 2023 00:20:19 +0200 Subject: [PATCH] Livewire Table --- app/Http/Livewire/UserTable.php | 127 +++++++++ composer.json | 2 + composer.lock | 261 ++++++++++++++---- config/livewire-tables.php | 8 + config/livewire.php | 158 +++++++++++ .../table-components/action.blade.php | 39 +++ resources/views/layouts/sidebar.blade.php | 3 +- resources/views/panel/users.blade.php | 183 +----------- routes/web.php | 1 + 9 files changed, 553 insertions(+), 229 deletions(-) create mode 100644 app/Http/Livewire/UserTable.php create mode 100644 config/livewire-tables.php create mode 100644 config/livewire.php create mode 100644 resources/views/components/table-components/action.blade.php diff --git a/app/Http/Livewire/UserTable.php b/app/Http/Livewire/UserTable.php new file mode 100644 index 0000000..eff6be9 --- /dev/null +++ b/app/Http/Livewire/UserTable.php @@ -0,0 +1,127 @@ +setPrimaryKey('id'); + } + + public function columns(): array + { + return [ + Column::make("Id", "id") + ->sortable() + ->searchable(), + Column::make("Name", "name") + ->sortable() + ->searchable(), + Column::make("Email", "email") + ->sortable() + ->searchable(), + Column::make("Littlelink name", "littlelink_name") + ->sortable() + ->searchable() + ->format(function ($value, $row, Column $column) { + if (!$row->littlelink_name == NULL) { + return "littlelink_name . "' target='_blank' class='text-info'>  " . $row->littlelink_name . " "; + } else { + return 'N/A'; + } + }) + ->html(), + Column::make("Role", "role") + ->sortable() + ->searchable(), + Column::make("Test", "id") + ->sortable() + ->format(function ($value, $row) { + $linkCount = Link::where('user_id', $row->id)->count(); + return $linkCount; + }), + Column::make("Clicks Sum", "id") + ->sortable() + ->format(function ($value, $row) { + $clicksSum = Link::where('user_id', $row->id)->sum('click_number'); + return $clicksSum; + }), + Column::make("E-mail", "email_verified_at") + ->sortable() + ->format(function ($value, $row, Column $column) { + if (env('REGISTER_AUTH') !== 'auth') { + if ($row->role == 'admin' && $row->email_verified_at != '') { + return '
-
'; + } else { + $verifyLink = route('verifyUser', [ + 'verify' => '-' . $row->email_verified_at, + 'id' => $row->id + ]); + if ($row->email_verified_at == '') { + return '' . __('messages.Pending') . ''; + } else { + return '' . __('messages.Verified') . ''; + } + } + } else { + return '
-
'; + } + return ''; + })->html(), + Column::make("Blocked", "block") + ->sortable() + ->format(function ($value, $row, Column $column) { + if ($row->role === 'admin' && $row->id === 1) { + return '
-
'; + } else { + $route = route('blockUser', ['block' => $row->block, 'id' => $row->id]); + if ($row->block === 'yes') { + $badge = ''.__('messages.Pending').''; + } elseif ($row->block === 'no') { + $badge = ''.__('messages.Approved').''; + } + return "$badge"; + } + }) + ->html(), + Column::make("Created at", "created_at") + ->sortable() + ->format(function ($value) { + if ($value) { + return $value->format('d/m/y'); + } else { + return ''; + } + }), + Column::make("Last seen", "updated_at") + ->sortable() + ->format(function ($value) { + $now = now(); + $diff = $now->diff($value); + + if ($diff->d < 1 && $diff->h < 1) { + return 'Now'; + } elseif ($diff->d < 1 && $diff->h < 24) { + return $diff->h . ' hours ago'; + } elseif ($diff->d < 365) { + return $diff->d . ' days ago'; + } else { + return $diff->y . ' years ago'; + } + }), + Column::make('Actions', "id") + ->format(function ($value, $row, Column $column) { + return view('components.table-components.action', ['user' => $row]); + }), + ]; + } +} diff --git a/composer.json b/composer.json index 366fd8e..7bf79c5 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,8 @@ "laravel/framework": "^9.52.4", "laravel/socialite": "^5.5", "laravel/tinker": "^2.5", + "livewire/livewire": "^2.12", + "rappasoft/laravel-livewire-tables": "^2.15", "spatie/laravel-backup": "^8.17" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 3053b67..da94a76 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f681cfe300acd922f41ba6210924fd7f", + "content-hash": "b2eafc10eb774aaa9bb7ce8353b44da2", "packages": [ { "name": "awssat/laravel-visits", @@ -1222,21 +1222,21 @@ }, { "name": "fruitcake/php-cors", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/fruitcake/php-cors.git", - "reference": "58571acbaa5f9f462c9c77e911700ac66f446d4e" + "reference": "3d158f36e7875e2f040f37bc0573956240a5a38b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fruitcake/php-cors/zipball/58571acbaa5f9f462c9c77e911700ac66f446d4e", - "reference": "58571acbaa5f9f462c9c77e911700ac66f446d4e", + "url": "https://api.github.com/repos/fruitcake/php-cors/zipball/3d158f36e7875e2f040f37bc0573956240a5a38b", + "reference": "3d158f36e7875e2f040f37bc0573956240a5a38b", "shasum": "" }, "require": { "php": "^7.4|^8.0", - "symfony/http-foundation": "^4.4|^5.4|^6" + "symfony/http-foundation": "^4.4|^5.4|^6|^7" }, "require-dev": { "phpstan/phpstan": "^1.4", @@ -1246,7 +1246,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -1277,7 +1277,7 @@ ], "support": { "issues": "https://github.com/fruitcake/php-cors/issues", - "source": "https://github.com/fruitcake/php-cors/tree/v1.2.0" + "source": "https://github.com/fruitcake/php-cors/tree/v1.3.0" }, "funding": [ { @@ -1289,7 +1289,7 @@ "type": "github" } ], - "time": "2022-02-20T15:07:15+00:00" + "time": "2023-10-12T05:21:21+00:00" }, { "name": "geo-sot/laravel-env-editor", @@ -2662,16 +2662,16 @@ }, { "name": "league/mime-type-detection", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96" + "reference": "b6a5854368533df0295c5761a0253656a2e52d9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96", - "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b6a5854368533df0295c5761a0253656a2e52d9e", + "reference": "b6a5854368533df0295c5761a0253656a2e52d9e", "shasum": "" }, "require": { @@ -2702,7 +2702,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.14.0" }, "funding": [ { @@ -2714,7 +2714,7 @@ "type": "tidelift" } ], - "time": "2023-08-05T12:09:49+00:00" + "time": "2023-10-17T14:13:20+00:00" }, { "name": "league/oauth1-client", @@ -2962,6 +2962,79 @@ ], "time": "2021-06-28T04:27:21+00:00" }, + { + "name": "livewire/livewire", + "version": "v2.12.6", + "source": { + "type": "git", + "url": "https://github.com/livewire/livewire.git", + "reference": "7d3a57b3193299cf1a0639a3935c696f4da2cf92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/livewire/livewire/zipball/7d3a57b3193299cf1a0639a3935c696f4da2cf92", + "reference": "7d3a57b3193299cf1a0639a3935c696f4da2cf92", + "shasum": "" + }, + "require": { + "illuminate/database": "^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "^7.0|^8.0|^9.0|^10.0", + "illuminate/validation": "^7.0|^8.0|^9.0|^10.0", + "league/mime-type-detection": "^1.9", + "php": "^7.2.5|^8.0", + "symfony/http-kernel": "^5.0|^6.0" + }, + "require-dev": { + "calebporzio/sushi": "^2.1", + "laravel/framework": "^7.0|^8.0|^9.0|^10.0", + "mockery/mockery": "^1.3.1", + "orchestra/testbench": "^5.0|^6.0|^7.0|^8.0", + "orchestra/testbench-dusk": "^5.2|^6.0|^7.0|^8.0", + "phpunit/phpunit": "^8.4|^9.0", + "psy/psysh": "@stable" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Livewire\\LivewireServiceProvider" + ], + "aliases": { + "Livewire": "Livewire\\Livewire" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Livewire\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Caleb Porzio", + "email": "calebporzio@gmail.com" + } + ], + "description": "A front-end framework for Laravel.", + "support": { + "issues": "https://github.com/livewire/livewire/issues", + "source": "https://github.com/livewire/livewire/tree/v2.12.6" + }, + "funding": [ + { + "url": "https://github.com/livewire", + "type": "github" + } + ], + "time": "2023-08-11T04:02:34+00:00" + }, { "name": "monolog/monolog", "version": "2.9.1", @@ -3581,16 +3654,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.38", + "version": "1.10.39", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d9dedb0413f678b4d03cbc2279a48f91592c97c4", + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4", "shasum": "" }, "require": { @@ -3639,7 +3712,7 @@ "type": "tidelift" } ], - "time": "2023-10-06T14:19:14+00:00" + "time": "2023-10-17T15:46:26+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -4156,16 +4229,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.21", + "version": "v0.11.22", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "bcb22101107f3bf770523b65630c9d547f60c540" + "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/bcb22101107f3bf770523b65630c9d547f60c540", - "reference": "bcb22101107f3bf770523b65630c9d547f60c540", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/128fa1b608be651999ed9789c95e6e2a31b5802b", + "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b", "shasum": "" }, "require": { @@ -4194,7 +4267,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.11.x-dev" + "dev-0.11": "0.11.x-dev" }, "bamarni-bin": { "bin-links": false, @@ -4230,9 +4303,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.21" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.22" }, - "time": "2023-09-17T21:15:54+00:00" + "time": "2023-10-14T21:56:36+00:00" }, { "name": "ralouphie/getallheaders", @@ -4460,6 +4533,78 @@ ], "time": "2023-04-15T23:01:58+00:00" }, + { + "name": "rappasoft/laravel-livewire-tables", + "version": "v2.15.0", + "source": { + "type": "git", + "url": "https://github.com/rappasoft/laravel-livewire-tables.git", + "reference": "26c596d4d4bb0e0efdfcd48de16071fc5ed969ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rappasoft/laravel-livewire-tables/zipball/26c596d4d4bb0e0efdfcd48de16071fc5ed969ef", + "reference": "26c596d4d4bb0e0efdfcd48de16071fc5ed969ef", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^8.0|^9.0|^10.0", + "livewire/livewire": "^2.6", + "php": "^7.4|^8.0|^8.1|^8.2", + "spatie/laravel-package-tools": "^1.4.3" + }, + "require-dev": { + "brianium/paratest": "^4.0|^5.0|^6.0|^7.0", + "ext-sqlite3": "*", + "nunomaduro/collision": "^4.0|^5.0|^6.0|^7.0", + "orchestra/testbench": "^6.0|^7.0|^8.0", + "phpunit/phpunit": "^9.0|^10.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Rappasoft\\LaravelLivewireTables\\LaravelLivewireTablesServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Rappasoft\\LaravelLivewireTables\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Rappa", + "email": "rappa819@gmail.com", + "role": "Developer" + } + ], + "description": "A dynamic table component for Laravel Livewire", + "homepage": "https://github.com/rappasoft/laravel-livewire-tables", + "keywords": [ + "datatables", + "laravel", + "livewire", + "rappasoft", + "tables" + ], + "support": { + "issues": "https://github.com/rappasoft/laravel-livewire-tables/issues", + "source": "https://github.com/rappasoft/laravel-livewire-tables/tree/v2.15.0" + }, + "funding": [ + { + "url": "https://github.com/rappasoft", + "type": "github" + } + ], + "time": "2023-07-15T19:50:12+00:00" + }, { "name": "spatie/db-dumper", "version": "3.4.0", @@ -7953,16 +8098,16 @@ }, { "name": "composer/pcre", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", "shasum": "" }, "require": { @@ -8004,7 +8149,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.0" + "source": "https://github.com/composer/pcre/tree/3.1.1" }, "funding": [ { @@ -8020,7 +8165,7 @@ "type": "tidelift" } ], - "time": "2022-11-17T09:50:14+00:00" + "time": "2023-10-11T07:11:09+00:00" }, { "name": "doctrine/instantiator", @@ -10359,35 +10504,35 @@ }, { "name": "spatie/flare-client-php", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/spatie/flare-client-php.git", - "reference": "5f2c6a7a0d2c1d90c12559dc7828fd942911a544" + "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5f2c6a7a0d2c1d90c12559dc7828fd942911a544", - "reference": "5f2c6a7a0d2c1d90c12559dc7828fd942911a544", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", + "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", "shasum": "" }, "require": { - "illuminate/pipeline": "^8.0|^9.0|^10.0", + "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0", "nesbot/carbon": "^2.62.1", "php": "^8.0", "spatie/backtrace": "^1.5.2", - "symfony/http-foundation": "^5.0|^6.0", - "symfony/mime": "^5.2|^6.0", - "symfony/process": "^5.2|^6.0", - "symfony/var-dumper": "^5.2|^6.0" + "symfony/http-foundation": "^5.2|^6.0|^7.0", + "symfony/mime": "^5.2|^6.0|^7.0", + "symfony/process": "^5.2|^6.0|^7.0", + "symfony/var-dumper": "^5.2|^6.0|^7.0" }, "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.3.0", - "pestphp/pest": "^1.20", + "dms/phpunit-arraysubset-asserts": "^0.5.0", + "pestphp/pest": "^1.20|^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "spatie/phpunit-snapshot-assertions": "^4.0" + "spatie/phpunit-snapshot-assertions": "^4.0|^5.0" }, "type": "library", "extra": { @@ -10417,7 +10562,7 @@ ], "support": { "issues": "https://github.com/spatie/flare-client-php/issues", - "source": "https://github.com/spatie/flare-client-php/tree/1.4.2" + "source": "https://github.com/spatie/flare-client-php/tree/1.4.3" }, "funding": [ { @@ -10425,20 +10570,20 @@ "type": "github" } ], - "time": "2023-07-28T08:07:24+00:00" + "time": "2023-10-17T15:54:07+00:00" }, { "name": "spatie/ignition", - "version": "1.11.2", + "version": "1.11.3", "source": { "type": "git", "url": "https://github.com/spatie/ignition.git", - "reference": "48b23411ca4bfbc75c75dfc638b6b36159c375aa" + "reference": "3d886de644ff7a5b42e4d27c1e1f67c8b5f00044" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/ignition/zipball/48b23411ca4bfbc75c75dfc638b6b36159c375aa", - "reference": "48b23411ca4bfbc75c75dfc638b6b36159c375aa", + "url": "https://api.github.com/repos/spatie/ignition/zipball/3d886de644ff7a5b42e4d27c1e1f67c8b5f00044", + "reference": "3d886de644ff7a5b42e4d27c1e1f67c8b5f00044", "shasum": "" }, "require": { @@ -10447,19 +10592,19 @@ "php": "^8.0", "spatie/backtrace": "^1.5.3", "spatie/flare-client-php": "^1.4.0", - "symfony/console": "^5.4|^6.0", - "symfony/var-dumper": "^5.4|^6.0" + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "require-dev": { - "illuminate/cache": "^9.52", + "illuminate/cache": "^9.52|^10.0|^11.0", "mockery/mockery": "^1.4", - "pestphp/pest": "^1.20", + "pestphp/pest": "^1.20|^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "psr/simple-cache-implementation": "*", - "symfony/cache": "^6.0", - "symfony/process": "^5.4|^6.0", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", "vlucas/phpdotenv": "^5.5" }, "suggest": { @@ -10508,7 +10653,7 @@ "type": "github" } ], - "time": "2023-09-19T15:29:52+00:00" + "time": "2023-10-18T14:09:40+00:00" }, { "name": "spatie/laravel-ignition", diff --git a/config/livewire-tables.php b/config/livewire-tables.php new file mode 100644 index 0000000..eb949f7 --- /dev/null +++ b/config/livewire-tables.php @@ -0,0 +1,8 @@ + 'bootstrap-5', +]; diff --git a/config/livewire.php b/config/livewire.php new file mode 100644 index 0000000..60be6db --- /dev/null +++ b/config/livewire.php @@ -0,0 +1,158 @@ + 'App\\Http\\Livewire', + + /* + |-------------------------------------------------------------------------- + | View Path + |-------------------------------------------------------------------------- + | + | This value sets the path for Livewire component views. This affects + | file manipulation helper commands like `artisan make:livewire`. + | + */ + + 'view_path' => resource_path('views/livewire'), + + /* + |-------------------------------------------------------------------------- + | Layout + |-------------------------------------------------------------------------- + | The default layout view that will be used when rendering a component via + | Route::get('/some-endpoint', SomeComponent::class);. In this case the + | the view returned by SomeComponent will be wrapped in "layouts.app" + | + */ + + 'layout' => 'layouts.app', + + /* + |-------------------------------------------------------------------------- + | Livewire Assets URL + |-------------------------------------------------------------------------- + | + | This value sets the path to Livewire JavaScript assets, for cases where + | your app's domain root is not the correct path. By default, Livewire + | will load its JavaScript assets from the app's "relative root". + | + | Examples: "/assets", "myurl.com/app". + | + */ + + 'asset_url' => url(''), + + /* + |-------------------------------------------------------------------------- + | Livewire App URL + |-------------------------------------------------------------------------- + | + | This value should be used if livewire assets are served from CDN. + | Livewire will communicate with an app through this url. + | + | Examples: "https://my-app.com", "myurl.com/app". + | + */ + + 'app_url' => null, + + /* + |-------------------------------------------------------------------------- + | Livewire Endpoint Middleware Group + |-------------------------------------------------------------------------- + | + | This value sets the middleware group that will be applied to the main + | Livewire "message" endpoint (the endpoint that gets hit everytime + | a Livewire component updates). It is set to "web" by default. + | + */ + + 'middleware_group' => 'web', + + /* + |-------------------------------------------------------------------------- + | Livewire Temporary File Uploads Endpoint Configuration + |-------------------------------------------------------------------------- + | + | Livewire handles file uploads by storing uploads in a temporary directory + | before the file is validated and stored permanently. All file uploads + | are directed to a global endpoint for temporary storage. The config + | items below are used for customizing the way the endpoint works. + | + */ + + 'temporary_file_upload' => [ + 'disk' => null, // Example: 'local', 's3' Default: 'default' + 'rules' => null, // Example: ['file', 'mimes:png,jpg'] Default: ['required', 'file', 'max:12288'] (12MB) + 'directory' => null, // Example: 'tmp' Default 'livewire-tmp' + 'middleware' => null, // Example: 'throttle:5,1' Default: 'throttle:60,1' + 'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs. + 'png', 'gif', 'bmp', 'svg', 'wav', 'mp4', + 'mov', 'avi', 'wmv', 'mp3', 'm4a', + 'jpg', 'jpeg', 'mpga', 'webp', 'wma', + ], + 'max_upload_time' => 5, // Max duration (in minutes) before an upload gets invalidated. + ], + + /* + |-------------------------------------------------------------------------- + | Manifest File Path + |-------------------------------------------------------------------------- + | + | This value sets the path to the Livewire manifest file. + | The default should work for most cases (which is + | "/bootstrap/cache/livewire-components.php"), but for specific + | cases like when hosting on Laravel Vapor, it could be set to a different value. + | + | Example: for Laravel Vapor, it would be "/tmp/storage/bootstrap/cache/livewire-components.php". + | + */ + + 'manifest_path' => null, + + /* + |-------------------------------------------------------------------------- + | Back Button Cache + |-------------------------------------------------------------------------- + | + | This value determines whether the back button cache will be used on pages + | that contain Livewire. By disabling back button cache, it ensures that + | the back button shows the correct state of components, instead of + | potentially stale, cached data. + | + | Setting it to "false" (default) will disable back button cache. + | + */ + + 'back_button_cache' => false, + + /* + |-------------------------------------------------------------------------- + | Render On Redirect + |-------------------------------------------------------------------------- + | + | This value determines whether Livewire will render before it's redirected + | or not. Setting it to "false" (default) will mean the render method is + | skipped when redirecting. And "true" will mean the render method is + | run before redirecting. Browsers bfcache can store a potentially + | stale view if render is skipped on redirect. + | + */ + + 'render_on_redirect' => false, + +]; diff --git a/resources/views/components/table-components/action.blade.php b/resources/views/components/table-components/action.blade.php new file mode 100644 index 0000000..3036f30 --- /dev/null +++ b/resources/views/components/table-components/action.blade.php @@ -0,0 +1,39 @@ +@if($user->role == 'admin' and $user->id == 1)
-
+@else +
+ + + + + + + + + + + + + + + + + + adminUser && Auth::user()->id !== $user->id && $user->block !== 'yes' && ($user->email_verified_at != '' || env('REGISTER_AUTH') == 'auth')) href="{{ route('authAsID', $user->id ) }}" @endif aria-label="Impersonate" data-bs-original-title="Impersonate"> + + + + + + + + + + + + + + + + +
+@endif \ No newline at end of file diff --git a/resources/views/layouts/sidebar.blade.php b/resources/views/layouts/sidebar.blade.php index e504803..74fb1a2 100755 --- a/resources/views/layouts/sidebar.blade.php +++ b/resources/views/layouts/sidebar.blade.php @@ -19,6 +19,7 @@ $usrhandl = Auth::user()->littlelink_name; + @livewireStyles @include('layouts.analytics') @stack('sidebar-stylesheets') @include('layouts.notifications') @@ -791,7 +792,7 @@ $usrhandl = Auth::user()->littlelink_name; - +@livewireScripts @stack('sidebar-scripts') diff --git a/resources/views/panel/users.blade.php b/resources/views/panel/users.blade.php index 3484957..1e73909 100755 --- a/resources/views/panel/users.blade.php +++ b/resources/views/panel/users.blade.php @@ -6,6 +6,10 @@ + +
@@ -19,131 +23,10 @@

{{__('messages.Manage Users')}}

- -
- @csrf -
-
-
- -
- -
-
-
-
-
{{__('messages.Users:')}} - All - - User - - Vip - - Admin - -
- - - - - - - - - - - - - @if(env('REGISTER_AUTH') !== 'auth')@endif - - - - - - @foreach($users as $user) - @php - $dateFormat = __('messages.date.format'); - - $date = date($dateFormat, strtotime($user->created_at)); - if(!isset($user->created_at)){$date = __('messages.N/A');} - - $lastSeen = $user->updated_at; - $lastSeenDate = date($dateFormat, strtotime($lastSeen)); - $timezone = new DateTimeZone(date_default_timezone_get()); - $datetime = new DateTime($lastSeen, $timezone); - $now = new DateTime(null, $timezone); - $interval = $now->diff($datetime); - $daysAgo = $interval->days." ".__('messages.days ago'); - if($interval->days == 1) $daysAgo = __('messages.1 day ago'); - if($interval->days == 0) $daysAgo = __('messages.Today'); - if ($interval->days >= 365) { - $yearsAgo = floor($interval->days / 365); - if ($yearsAgo == 1) { - $daysAgo = __('messages.1 year ago'); - } else { - $daysAgo = $yearsAgo . __('messages.years ago'); - }} - @endphp - - - - - - - - - - - @if(env('REGISTER_AUTH') !== 'auth') - - @endif - @endif - - - - @endforeach - -
{{__('messages.ID')}}{{__('messages.Name')}}{{__('messages.E-Mail')}}{{__('messages.Page')}}{{__('messages.Role')}}{{__('messages.Links')}}{{__('messages.Clicks')}}{{__('messages.Created at')}}{{__('messages.Last seen')}}{{__('messages.E-Mail')}}{{__('messages.Status')}}{{__('messages.Action')}}
{{ $user->id }} {{ $user->name }} {{ $user->email }} @if(isset($user->littlelink_name))  {{ $user->littlelink_name }} @else {{__('messages.N/A')}} @endif{{ $user->role }}{{$user->links}}{{$user->clicks}}{{$date}}{{$daysAgo}}@if($user->role == 'admin' and $user->email_verified_at != '')
-
@else - @if($user->email_verified_at == ''){{__('messages.Pending')}}@else{{__('messages.Verified')}}@endif
@if($user->role == 'admin' and $user->id == 1)
-
@else@if($user->block == 'yes') {{__('messages.Pending')}} @elseif($user->block == 'no') {{__('messages.Approved')}} @endif@endif
- @if($user->role == 'admin' and $user->id == 1)
-
- @else - - @endif -
-
+ + + + {{__('messages.Add new user')}} +@endpush + @push('sidebar-scripts') - + + @endpush @endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 2bf9c4d..2891f09 100755 --- a/routes/web.php +++ b/routes/web.php @@ -191,6 +191,7 @@ Route::group([ Route::get('/send-test-email', [AdminController::class, 'SendTestMail'])->name('SendTestMail'); Route::get('/auth-as/{id}', [AdminController::class, 'authAsID'])->name('authAsID'); Route::get('/theme-updater', function () {return view('studio/theme-updater', []);}); + Route::get('/table', function () {return view('vendor/livewire-tables/datatable', ['this' => NULL]);}); Route::get('/update', function () {return view('update', []);}); Route::get('/backup', function () {return view('backup', []);});