Compare commits

...

20 Commits
v0.3 ... master

Author SHA1 Message Date
0ffe415166 Merge pull request 'feat: add helper, clean up code, remove test route' (#29) from feat/request-quotes-from-fe into master
All checks were successful
deploy / production (push) Successful in 9m58s
Reviewed-on: #29
2023-10-28 10:43:13 -04:00
dcf8c28f1a fix: return type and typing on send 2023-10-28 22:47:32 +11:00
f4f7373272 feat: add helper, clean up code, remove test route 2023-10-26 20:14:05 +11:00
ben
c963982bfb Biiig feex
All checks were successful
deploy / production (push) Successful in 8m42s
2023-10-17 02:15:21 -04:00
22338754f9 Merge pull request 'feat/ISSUE-11-add-logging' (#23) from feat/ISSUE-11-add-logging into master
All checks were successful
deploy / production (push) Successful in 8m32s
Reviewed-on: #23
2023-10-16 03:26:54 -04:00
2adff37550 feat: better automatic descriptions 2023-10-16 18:22:18 +11:00
aace075321 chore: bump composer 2023-10-16 18:02:19 +11:00
b12d08c19d Merge remote-tracking branch 'origin/master' into feat/ISSUE-11-add-logging
# Conflicts:
#	.github/workflows/deploy.yml
#	composer.lock
2023-10-16 17:56:53 +11:00
0e2da9cd3e Update .github/workflows/deploy.yml 2023-10-14 04:03:51 -04:00
6b6010ccc0 chore: bump composer 2023-10-12 23:10:02 +11:00
12893399c8 feat: backmerge 2023-10-12 22:58:39 +11:00
60f191c3c1 style: fix light mode hover 2023-10-12 22:55:39 +11:00
7d94630fd6 feat: swap over to spatie logger 2023-10-12 22:51:26 +11:00
d3864a69f1 Merge branch 'master' into feat/ISSUE-11-add-logging 2023-10-11 22:28:50 +11:00
2d5991988d feat: rework logging 2023-10-11 22:28:14 +11:00
87bdbeee05 Merge branch 'master' into feat/ISSUE-11-add-logging 2023-10-11 17:40:49 +11:00
13c5cafa9f fix: route name 2023-10-11 00:29:16 +11:00
e3bb7cb69f feat: basic log page 2023-10-10 23:48:05 +11:00
faaed8fa1b feat: logging 2023-10-10 20:49:51 +11:00
b3784b77b1 feat: remove old code 2023-10-10 20:46:03 +11:00
35 changed files with 909 additions and 415 deletions

View File

@ -15,16 +15,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
# - name: Get composer cache directory
# id: composer-cache
# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
# - name: Cache dependencies
# uses: actions/cache@v3
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: ${{ runner.os }}-composer-
- name: Setup PHP
uses: shivammathur/setup-php@v2

41
app/Helpers/Slack.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace App\Helpers;
use App\Models\Quote;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
class Slack
{
private string $url;
public function __construct()
{
$this->url = config('bot.webhook');
}
private function send(string $text): Response
{
return Http::post($this->url, ['text' => $text]);
}
public function sendText(string $text): Response
{
activity()
->event('send')
->log("Manually sent quote: $text");
return $this->send($text);
}
public function sendQuote(Quote $quote): Response
{
activity()
->performedOn($quote)
->event('send')
->log("Requested quote: $quote");
return $this->send($quote->quote);
}
}

View File

@ -3,36 +3,33 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use App\Http\Requests\StoreUserRequest;
use Illuminate\Support\Facades\Validator;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Throwable;
class UserController extends Controller
{
public function registerUser(StoreUserRequest $request)
{
$data = $request->validated();
$data['password'] = Str::random(8);
$validated = $request->validated();
$validated['is_admin'] = false;
$validated['password'] = Str::random(8);
$validated['status'] = true;
try {
$user = User::create($validated);
}catch (Throwable $exception){
$user = User::create($data);
} catch (Throwable $exception) {
return response()
->json($exception);
->json($exception);
}
return response()
->json(['message' => 'Successfully created user ' . $user->firstname]);
->json(['message' => 'Successfully created user ' . $user->firstname]);
}
public function getUser(Request $request, User $user)
{
return response()
->json(["status" => true]);
->json(['status' => true]);
}
}

View File

@ -2,39 +2,36 @@
namespace App\Http\Controllers\Api;
use App\Helpers\Slack;
use App\Http\Controllers\Controller;
use App\Models\Quote;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class WebHookController extends Controller
{
public function webHookSend(string $payload)
{
$data = ['text' => $payload];
$response = Http::post(config('bot.webhook'), $data);
private Slack $slack;
public function __construct() {
$this->slack = new Slack();
}
public function sendQuote(Request $request)
{
$quote = $request->input('quote');
if (empty($quote)) {
return;
}
$this->webHookSend($quote);
$this->slack->sendText($quote);
}
public function sendRandomQuote()
{
$quote = Quote::inRandomOrder()->first()->quote;
$this->webHookSend($quote);
}
$quote = Quote::inRandomOrder()->first();
public function test()
{
var_dump('secrets');
$this->slack->sendQuote($quote);
}
}

View File

@ -2,23 +2,49 @@
namespace App\Models;
use App\Helpers\Slack;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Models\Activity;
use Spatie\Activitylog\Traits\LogsActivity;
/**
* @mixin IdeHelperQuote
*/
class Quote extends Model
{
use SoftDeletes;
use LogsActivity, SoftDeletes;
protected $fillable = [
'user_id',
'quote',
];
public function request(): void
{
// Send the notification
// If success, add it to the transactions
$slack = new Slack();
$slack->sendQuote($this);
}
protected $fillable = [
'quote',
];
public function tapActivity(Activity $activity, string $eventName)
{
switch ($eventName) {
case 'created':
$activity->description = "Quote created: {$this->quote}";
return;
case 'deleted':
$activity->description = "Quote deleted: {$this->quote}";
return;
default;
return;
}
}
public function getActivityLogOptions(): LogOptions
{
return LogOptions::defaults()
->logOnly(['quote']);
}
}

View File

@ -4,33 +4,57 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\Activitylog\Facades\LogBatch;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Models\Activity;
use Spatie\Activitylog\Traits\LogsActivity;
/**
* @mixin IdeHelperRequestedQuote
*/
class RequestedQuote extends Model
{
use SoftDeletes;
use LogsActivity, SoftDeletes;
protected $fillable = [
'quote',
'user_id',
];
public function approve(): void
{
// TODO: we'll probs want to log who approved this quote
LogBatch::startBatch();
Quote::create([
'quote' => $this->quote,
]);
$this->delete();
LogBatch::endBatch();
}
public function reject(): void
{
// TODO: we'll probs want to log who reject this quote
$this->delete();
}
public function tapActivity(Activity $activity, string $eventName)
{
switch ($eventName) {
case 'created':
$activity->description = "Quote created: {$this->quote}";
return;
case 'deleted':
$activity->description = "Quote deleted: {$this->quote}";
return;
default;
return;
}
}
public function getActivityLogOptions(): LogOptions
{
return LogOptions::defaults()
->logOnly(['quote']);
}
}

View File

@ -5,14 +5,26 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Models\Activity;
use Spatie\Activitylog\Traits\LogsActivity;
/**
* @mixin IdeHelperUser
*/
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
use LogsActivity, HasFactory, Notifiable;
/**
* The model's default values for attributes.
*
* @var array
*/
protected $attributes = [
'is_admin' => false,
'status' => true,
];
/**
* The attributes that are mass assignable.
@ -46,6 +58,33 @@ class User extends Authenticatable
* @var array<string, string>
*/
protected $casts = [
'is_admin' => 'boolean',
'status' => 'boolean',
'password' => 'hashed',
];
public function getFullNameAttribute(): string
{
return "$this->firstname $this->lastname";
}
public function tapActivity(Activity $activity, string $eventName)
{
switch ($eventName) {
case 'created':
$activity->description = "User created: {$this->full_name}";
return;
case 'deleted':
$activity->description = "User deleted: {$this->full_name}";
return;
default;
return;
}
}
public function getActivityLogOptions(): LogOptions
{
return LogOptions::defaults()
->logExcept(['password']);
}
}

View File

@ -3,6 +3,7 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Spatie\Activitylog\Models\Activity;
class AppServiceProvider extends ServiceProvider
{
@ -15,6 +16,7 @@ class AppServiceProvider extends ServiceProvider
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
// This is so we can access alpine without livewire on the page.
\Livewire\Livewire::forceAssetInjection();
}
@ -23,6 +25,8 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(): void
{
//
Activity::saving(function (Activity $activity) {
$activity->properties = $activity->properties->put('ip', request()->ip());
});
}
}

View File

@ -11,7 +11,8 @@
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"livewire/livewire": "^3.0",
"livewire/volt": "^1.0"
"livewire/volt": "^1.0",
"spatie/laravel-activitylog": "^4.7"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.13",

390
composer.lock generated
View File

@ -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": "6f613b80fde0f91b5425be61accfc51f",
"content-hash": "e30e72a75870b7f76938f6dd2adff20c",
"packages": [
{
"name": "brick/math",
@ -434,21 +434,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",
@ -458,7 +458,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.1-dev"
"dev-master": "1.2-dev"
}
},
"autoload": {
@ -489,7 +489,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": [
{
@ -501,7 +501,7 @@
"type": "github"
}
],
"time": "2022-02-20T15:07:15+00:00"
"time": "2023-10-12T05:21:21+00:00"
},
{
"name": "graham-campbell/result-type",
@ -972,16 +972,16 @@
},
{
"name": "laravel/framework",
"version": "v10.26.2",
"version": "v10.28.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "6e5440f7c518f26b4495e5d7e4796ec239e26df9"
"reference": "09137f50f715c1efc649788a26092dcb1ec4ab6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/6e5440f7c518f26b4495e5d7e4796ec239e26df9",
"reference": "6e5440f7c518f26b4495e5d7e4796ec239e26df9",
"url": "https://api.github.com/repos/laravel/framework/zipball/09137f50f715c1efc649788a26092dcb1ec4ab6e",
"reference": "09137f50f715c1efc649788a26092dcb1ec4ab6e",
"shasum": ""
},
"require": {
@ -1168,7 +1168,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2023-10-03T14:24:20+00:00"
"time": "2023-10-10T13:01:37+00:00"
},
{
"name": "laravel/prompts",
@ -1818,16 +1818,16 @@
},
{
"name": "livewire/livewire",
"version": "v3.0.5",
"version": "v3.0.8",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "37f11583c61a75d51b2146c2fe38f506ad36014b"
"reference": "6f62019a0e821894f701ca463210c01d7369c929"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/37f11583c61a75d51b2146c2fe38f506ad36014b",
"reference": "37f11583c61a75d51b2146c2fe38f506ad36014b",
"url": "https://api.github.com/repos/livewire/livewire/zipball/6f62019a0e821894f701ca463210c01d7369c929",
"reference": "6f62019a0e821894f701ca463210c01d7369c929",
"shasum": ""
},
"require": {
@ -1836,15 +1836,15 @@
"illuminate/validation": "^10.0",
"league/mime-type-detection": "^1.9",
"php": "^8.1",
"symfony/http-kernel": "^5.0|^6.0"
"symfony/http-kernel": "^6.2"
},
"require-dev": {
"calebporzio/sushi": "^2.1",
"laravel/framework": "^10.0",
"laravel/prompts": "^0.1.6",
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^7.0|^8.0",
"orchestra/testbench-dusk": "^7.0|^8.0",
"orchestra/testbench": "^8.0",
"orchestra/testbench-dusk": "^8.0",
"phpunit/phpunit": "^9.0",
"psy/psysh": "@stable"
},
@ -1880,7 +1880,7 @@
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v3.0.5"
"source": "https://github.com/livewire/livewire/tree/v3.0.8"
},
"funding": [
{
@ -1888,7 +1888,7 @@
"type": "github"
}
],
"time": "2023-09-16T11:51:32+00:00"
"time": "2023-10-10T20:44:46+00:00"
},
{
"name": "livewire/volt",
@ -2948,16 +2948,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": {
@ -2986,7 +2986,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "0.11.x-dev"
"dev-0.11": "0.11.x-dev"
},
"bamarni-bin": {
"bin-links": false,
@ -3022,9 +3022,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",
@ -3251,6 +3251,157 @@
],
"time": "2023-04-15T23:01:58+00:00"
},
{
"name": "spatie/laravel-activitylog",
"version": "4.7.3",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-activitylog.git",
"reference": "ec65a478a909b8df1b4f0c3c45de2592ca7639e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-activitylog/zipball/ec65a478a909b8df1b4f0c3c45de2592ca7639e5",
"reference": "ec65a478a909b8df1b4f0c3c45de2592ca7639e5",
"shasum": ""
},
"require": {
"illuminate/config": "^8.0 || ^9.0 || ^10.0",
"illuminate/database": "^8.69 || ^9.27 || ^10.0",
"illuminate/support": "^8.0 || ^9.0 || ^10.0",
"php": "^8.0",
"spatie/laravel-package-tools": "^1.6.3"
},
"require-dev": {
"ext-json": "*",
"orchestra/testbench": "^6.23 || ^7.0 || ^8.0",
"pestphp/pest": "^1.20"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\Activitylog\\ActivitylogServiceProvider"
]
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Spatie\\Activitylog\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Sebastian De Deyne",
"email": "sebastian@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Tom Witkowski",
"email": "dev.gummibeer@gmail.com",
"homepage": "https://gummibeer.de",
"role": "Developer"
}
],
"description": "A very simple activity logger to monitor the users of your website or application",
"homepage": "https://github.com/spatie/activitylog",
"keywords": [
"activity",
"laravel",
"log",
"spatie",
"user"
],
"support": {
"issues": "https://github.com/spatie/laravel-activitylog/issues",
"source": "https://github.com/spatie/laravel-activitylog/tree/4.7.3"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2023-01-25T17:04:51+00:00"
},
{
"name": "spatie/laravel-package-tools",
"version": "1.16.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-package-tools.git",
"reference": "cc7c991555a37f9fa6b814aa03af73f88026a83d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/cc7c991555a37f9fa6b814aa03af73f88026a83d",
"reference": "cc7c991555a37f9fa6b814aa03af73f88026a83d",
"shasum": ""
},
"require": {
"illuminate/contracts": "^9.28|^10.0",
"php": "^8.0"
},
"require-dev": {
"mockery/mockery": "^1.5",
"orchestra/testbench": "^7.7|^8.0",
"pestphp/pest": "^1.22",
"phpunit/phpunit": "^9.5.24",
"spatie/pest-plugin-test-time": "^1.1"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\LaravelPackageTools\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"description": "Tools for creating Laravel packages",
"homepage": "https://github.com/spatie/laravel-package-tools",
"keywords": [
"laravel-package-tools",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/laravel-package-tools/issues",
"source": "https://github.com/spatie/laravel-package-tools/tree/1.16.1"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2023-08-23T09:04:39+00:00"
},
{
"name": "symfony/console",
"version": "v6.3.4",
@ -5921,16 +6072,16 @@
},
{
"name": "brianium/paratest",
"version": "v7.2.9",
"version": "v7.3.0",
"source": {
"type": "git",
"url": "https://github.com/paratestphp/paratest.git",
"reference": "1f9e41c0779be4540654d92a9314016713f5e62c"
"reference": "2951d3f773ea91451c7440f48122287778634b0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/1f9e41c0779be4540654d92a9314016713f5e62c",
"reference": "1f9e41c0779be4540654d92a9314016713f5e62c",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/2951d3f773ea91451c7440f48122287778634b0d",
"reference": "2951d3f773ea91451c7440f48122287778634b0d",
"shasum": ""
},
"require": {
@ -5944,22 +6095,22 @@
"phpunit/php-code-coverage": "^10.1.7",
"phpunit/php-file-iterator": "^4.1.0",
"phpunit/php-timer": "^6.0",
"phpunit/phpunit": "^10.4.0",
"phpunit/phpunit": "^10.4.1",
"sebastian/environment": "^6.0.1",
"symfony/console": "^6.3.4",
"symfony/process": "^6.3.4"
"symfony/console": "^6.3.4 || ^7.0.0",
"symfony/process": "^6.3.4 || ^7.0.0"
},
"require-dev": {
"doctrine/coding-standard": "^12.0.0",
"ext-pcov": "*",
"ext-posix": "*",
"infection/infection": "^0.27.3",
"phpstan/phpstan": "^1.10.37",
"infection/infection": "^0.27.4",
"phpstan/phpstan": "^1.10.38",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-phpunit": "^1.3.14",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.1",
"squizlabs/php_codesniffer": "^3.7.2",
"symfony/filesystem": "^6.3.1"
"symfony/filesystem": "^6.3.1 || ^7.0.0"
},
"bin": [
"bin/paratest",
@ -6000,7 +6151,7 @@
],
"support": {
"issues": "https://github.com/paratestphp/paratest/issues",
"source": "https://github.com/paratestphp/paratest/tree/v7.2.9"
"source": "https://github.com/paratestphp/paratest/tree/v7.3.0"
},
"funding": [
{
@ -6012,7 +6163,7 @@
"type": "paypal"
}
],
"time": "2023-10-06T07:53:04+00:00"
"time": "2023-10-10T15:11:25+00:00"
},
{
"name": "composer/class-map-generator",
@ -6089,16 +6240,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": {
@ -6140,7 +6291,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": [
{
@ -6156,7 +6307,7 @@
"type": "tidelift"
}
],
"time": "2022-11-17T09:50:14+00:00"
"time": "2023-10-11T07:11:09+00:00"
},
{
"name": "deployer/deployer",
@ -6296,16 +6447,16 @@
},
{
"name": "doctrine/dbal",
"version": "3.7.0",
"version": "3.7.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "00d03067f07482f025d41ab55e4ba0db5eca2cdf"
"reference": "5b7bd66c9ff58c04c5474ab85edce442f8081cb2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/00d03067f07482f025d41ab55e4ba0db5eca2cdf",
"reference": "00d03067f07482f025d41ab55e4ba0db5eca2cdf",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/5b7bd66c9ff58c04c5474ab85edce442f8081cb2",
"reference": "5b7bd66c9ff58c04c5474ab85edce442f8081cb2",
"shasum": ""
},
"require": {
@ -6389,7 +6540,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.7.0"
"source": "https://github.com/doctrine/dbal/tree/3.7.1"
},
"funding": [
{
@ -6405,7 +6556,7 @@
"type": "tidelift"
}
],
"time": "2023-09-26T20:56:55+00:00"
"time": "2023-10-06T05:06:20+00:00"
},
{
"name": "doctrine/deprecations",
@ -6857,16 +7008,16 @@
},
{
"name": "laravel/breeze",
"version": "v1.24.1",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/breeze.git",
"reference": "15c8866a19a5469c34748586162a238efa27fa51"
"reference": "d62371252246d45417d077ca8019b6abd679343c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/breeze/zipball/15c8866a19a5469c34748586162a238efa27fa51",
"reference": "15c8866a19a5469c34748586162a238efa27fa51",
"url": "https://api.github.com/repos/laravel/breeze/zipball/d62371252246d45417d077ca8019b6abd679343c",
"reference": "d62371252246d45417d077ca8019b6abd679343c",
"shasum": ""
},
"require": {
@ -6915,20 +7066,20 @@
"issues": "https://github.com/laravel/breeze/issues",
"source": "https://github.com/laravel/breeze"
},
"time": "2023-10-04T01:03:14+00:00"
"time": "2023-10-06T13:24:19+00:00"
},
{
"name": "laravel/pint",
"version": "v1.13.2",
"version": "v1.13.3",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "bbb13460d7f8c5c0cd9a58109beedd79cd7331ff"
"reference": "93b2d0d49719bc6e444ba21cd4dbbccec935413d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/bbb13460d7f8c5c0cd9a58109beedd79cd7331ff",
"reference": "bbb13460d7f8c5c0cd9a58109beedd79cd7331ff",
"url": "https://api.github.com/repos/laravel/pint/zipball/93b2d0d49719bc6e444ba21cd4dbbccec935413d",
"reference": "93b2d0d49719bc6e444ba21cd4dbbccec935413d",
"shasum": ""
},
"require": {
@ -6939,7 +7090,7 @@
"php": "^8.1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.26.1",
"friendsofphp/php-cs-fixer": "^3.34.1",
"illuminate/view": "^10.23.1",
"laravel-zero/framework": "^10.1.2",
"mockery/mockery": "^1.6.6",
@ -6981,7 +7132,7 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2023-09-19T15:55:02+00:00"
"time": "2023-10-10T15:39:09+00:00"
},
{
"name": "laravel/sail",
@ -7194,16 +7345,16 @@
},
{
"name": "nunomaduro/collision",
"version": "v7.9.0",
"version": "v7.10.0",
"source": {
"type": "git",
"url": "https://github.com/nunomaduro/collision.git",
"reference": "296d0cf9fe462837ac0da8a568b56fc026b132da"
"reference": "49ec67fa7b002712da8526678abd651c09f375b2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/296d0cf9fe462837ac0da8a568b56fc026b132da",
"reference": "296d0cf9fe462837ac0da8a568b56fc026b132da",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/49ec67fa7b002712da8526678abd651c09f375b2",
"reference": "49ec67fa7b002712da8526678abd651c09f375b2",
"shasum": ""
},
"require": {
@ -7212,19 +7363,22 @@
"php": "^8.1.0",
"symfony/console": "^6.3.4"
},
"conflict": {
"laravel/framework": ">=11.0.0"
},
"require-dev": {
"brianium/paratest": "^7.2.7",
"laravel/framework": "^10.23.1",
"laravel/pint": "^1.13.1",
"brianium/paratest": "^7.3.0",
"laravel/framework": "^10.28.0",
"laravel/pint": "^1.13.3",
"laravel/sail": "^1.25.0",
"laravel/sanctum": "^3.3.1",
"laravel/tinker": "^2.8.2",
"nunomaduro/larastan": "^2.6.4",
"orchestra/testbench-core": "^8.11.0",
"pestphp/pest": "^2.19.1",
"phpunit/phpunit": "^10.3.5",
"orchestra/testbench-core": "^8.13.0",
"pestphp/pest": "^2.23.2",
"phpunit/phpunit": "^10.4.1",
"sebastian/environment": "^6.0.1",
"spatie/laravel-ignition": "^2.3.0"
"spatie/laravel-ignition": "^2.3.1"
},
"type": "library",
"extra": {
@ -7283,33 +7437,33 @@
"type": "patreon"
}
],
"time": "2023-09-19T10:45:09+00:00"
"time": "2023-10-11T15:45:01+00:00"
},
{
"name": "pestphp/pest",
"version": "v2.21.0",
"version": "v2.23.2",
"source": {
"type": "git",
"url": "https://github.com/pestphp/pest.git",
"reference": "2ffafd445d42c8b7b7e1874bde1c29945767a49d"
"reference": "b126e8e6e4afd6562e80c5dafcc2a973f17a09b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pestphp/pest/zipball/2ffafd445d42c8b7b7e1874bde1c29945767a49d",
"reference": "2ffafd445d42c8b7b7e1874bde1c29945767a49d",
"url": "https://api.github.com/repos/pestphp/pest/zipball/b126e8e6e4afd6562e80c5dafcc2a973f17a09b3",
"reference": "b126e8e6e4afd6562e80c5dafcc2a973f17a09b3",
"shasum": ""
},
"require": {
"brianium/paratest": "^7.2.9",
"nunomaduro/collision": "^7.9.0",
"nunomaduro/termwind": "^1.15.1",
"brianium/paratest": "^7.3.0",
"nunomaduro/collision": "^7.9.0|^8.0.0",
"nunomaduro/termwind": "^1.15.1|^2.0.0",
"pestphp/pest-plugin": "^2.1.1",
"pestphp/pest-plugin-arch": "^2.3.3",
"pestphp/pest-plugin-arch": "^2.4.0",
"php": "^8.1.0",
"phpunit/phpunit": "^10.4.0"
"phpunit/phpunit": "^10.4.1"
},
"conflict": {
"phpunit/phpunit": ">10.4.0",
"phpunit/phpunit": ">10.4.1",
"sebastian/exporter": "<5.1.0",
"webmozart/assert": "<1.11.0"
},
@ -7374,7 +7528,7 @@
],
"support": {
"issues": "https://github.com/pestphp/pest/issues",
"source": "https://github.com/pestphp/pest/tree/v2.21.0"
"source": "https://github.com/pestphp/pest/tree/v2.23.2"
},
"funding": [
{
@ -7386,7 +7540,7 @@
"type": "github"
}
],
"time": "2023-10-06T12:33:39+00:00"
"time": "2023-10-10T15:40:34+00:00"
},
{
"name": "pestphp/pest-plugin",
@ -7460,26 +7614,26 @@
},
{
"name": "pestphp/pest-plugin-arch",
"version": "v2.3.3",
"version": "v2.4.1",
"source": {
"type": "git",
"url": "https://github.com/pestphp/pest-plugin-arch.git",
"reference": "b758990e83f89daba3c45672398579cf8692213f"
"reference": "59698f0a381c5bc4fa2cd5b6ed331067c4501fdb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/b758990e83f89daba3c45672398579cf8692213f",
"reference": "b758990e83f89daba3c45672398579cf8692213f",
"url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/59698f0a381c5bc4fa2cd5b6ed331067c4501fdb",
"reference": "59698f0a381c5bc4fa2cd5b6ed331067c4501fdb",
"shasum": ""
},
"require": {
"nunomaduro/collision": "^7.8.1",
"pestphp/pest-plugin": "^2.0.1",
"nunomaduro/collision": "^7.10.0|^8.0.0",
"pestphp/pest-plugin": "^2.1.1",
"php": "^8.1",
"ta-tikoma/phpunit-architecture-test": "^0.7.4"
"ta-tikoma/phpunit-architecture-test": "^0.7.5"
},
"require-dev": {
"pestphp/pest": "^2.16.0",
"pestphp/pest": "^2.23.2",
"pestphp/pest-dev-tools": "^2.16.0"
},
"type": "library",
@ -7508,7 +7662,7 @@
"unit"
],
"support": {
"source": "https://github.com/pestphp/pest-plugin-arch/tree/v2.3.3"
"source": "https://github.com/pestphp/pest-plugin-arch/tree/v2.4.1"
},
"funding": [
{
@ -7520,7 +7674,7 @@
"type": "github"
}
],
"time": "2023-08-21T16:06:30+00:00"
"time": "2023-10-12T15:35:38+00:00"
},
{
"name": "pestphp/pest-plugin-laravel",
@ -8240,16 +8394,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.4.0",
"version": "10.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "9784e877e3700de37475545bdbdce8383ff53d25"
"reference": "62bd7af13d282deeb95650077d28ba3600ca321c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9784e877e3700de37475545bdbdce8383ff53d25",
"reference": "9784e877e3700de37475545bdbdce8383ff53d25",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/62bd7af13d282deeb95650077d28ba3600ca321c",
"reference": "62bd7af13d282deeb95650077d28ba3600ca321c",
"shasum": ""
},
"require": {
@ -8321,7 +8475,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.0"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.1"
},
"funding": [
{
@ -8337,7 +8491,7 @@
"type": "tidelift"
}
],
"time": "2023-10-06T03:41:22+00:00"
"time": "2023-10-08T05:01:11+00:00"
},
{
"name": "psr/cache",
@ -9520,16 +9674,16 @@
},
{
"name": "spatie/laravel-ignition",
"version": "2.3.0",
"version": "2.3.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ignition.git",
"reference": "4ed813d16edb5a1ab0d7f4b1d116c37ee8cdf3c0"
"reference": "bf21cd15aa47fa4ec5d73bbc932005c70261efc8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/4ed813d16edb5a1ab0d7f4b1d116c37ee8cdf3c0",
"reference": "4ed813d16edb5a1ab0d7f4b1d116c37ee8cdf3c0",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/bf21cd15aa47fa4ec5d73bbc932005c70261efc8",
"reference": "bf21cd15aa47fa4ec5d73bbc932005c70261efc8",
"shasum": ""
},
"require": {
@ -9608,7 +9762,7 @@
"type": "github"
}
],
"time": "2023-08-23T06:24:34+00:00"
"time": "2023-10-09T12:55:26+00:00"
},
{
"name": "symfony/yaml",
@ -9684,16 +9838,16 @@
},
{
"name": "ta-tikoma/phpunit-architecture-test",
"version": "0.7.4",
"version": "0.7.5",
"source": {
"type": "git",
"url": "https://github.com/ta-tikoma/phpunit-architecture-test.git",
"reference": "abe1f8a5f4635e7cbe0a8a37d6b8d20c687af0f2"
"reference": "9eb08437e8f0c0c75cc947a373cf49672c335827"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/abe1f8a5f4635e7cbe0a8a37d6b8d20c687af0f2",
"reference": "abe1f8a5f4635e7cbe0a8a37d6b8d20c687af0f2",
"url": "https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/9eb08437e8f0c0c75cc947a373cf49672c335827",
"reference": "9eb08437e8f0c0c75cc947a373cf49672c335827",
"shasum": ""
},
"require": {
@ -9701,7 +9855,7 @@
"php": "^8.1.0",
"phpdocumentor/reflection-docblock": "^5.3.0",
"phpunit/phpunit": "^10.1.1",
"symfony/finder": "^6.2.7"
"symfony/finder": "^6.2.7 || ^7.0.0"
},
"require-dev": {
"laravel/pint": "^1.9.0",
@ -9737,9 +9891,9 @@
],
"support": {
"issues": "https://github.com/ta-tikoma/phpunit-architecture-test/issues",
"source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.7.4"
"source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.7.5"
},
"time": "2023-08-03T06:50:14+00:00"
"time": "2023-10-12T15:31:50+00:00"
},
{
"name": "theseer/tokenizer",

52
config/activitylog.php Normal file
View File

@ -0,0 +1,52 @@
<?php
return [
/*
* If set to false, no activities will be saved to the database.
*/
'enabled' => env('ACTIVITY_LOGGER_ENABLED', true),
/*
* When the clean-command is executed, all recording activities older than
* the number of days specified here will be deleted.
*/
'delete_records_older_than_days' => 365,
/*
* If no log name is passed to the activity() helper
* we use this default log name.
*/
'default_log_name' => 'default',
/*
* You can specify an auth driver here that gets user models.
* If this is null we'll use the current Laravel auth driver.
*/
'default_auth_driver' => null,
/*
* If set to true, the subject returns soft deleted models.
*/
'subject_returns_soft_deleted_models' => true,
/*
* This model will be used to log activity.
* It should implement the Spatie\Activitylog\Contracts\Activity interface
* and extend Illuminate\Database\Eloquent\Model.
*/
'activity_model' => \Spatie\Activitylog\Models\Activity::class,
/*
* This is the name of the table that will be created by the migration and
* used by the Activity model shipped with this package.
*/
'table_name' => 'activity_log',
/*
* This is the database connection that will be used by the migration and
* the Activity model shipped with this package. In case it's not set
* Laravel's database.default will be used instead.
*/
'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION'),
];

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateActivityLogTable extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('log_name')->nullable();
$table->text('description');
$table->nullableMorphs('subject', 'subject');
$table->nullableMorphs('causer', 'causer');
$table->json('properties')->nullable();
$table->timestamps();
$table->index('log_name');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
}
}

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddEventColumnToActivityLogTable extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->string('event')->nullable()->after('subject_type');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('event');
});
}
}

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBatchUuidColumnToActivityLogTable extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->uuid('batch_uuid')->nullable()->after('properties');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('batch_uuid');
});
}
}

View File

@ -12,7 +12,7 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
$this->call(BaseQuotesSeeder::class);
$this->call(PriceyBotSeeder::class);
$this->call(BaseQuotesSeeder::class);
}
}

View File

@ -37,7 +37,7 @@ run("cd {{release_path}} && {{bin/npm}} run {$command}");
});
task('perm:fix', function () {
run("chown -R nginx:nginx /opt/PriceyBotPanel");
run("chown -R nginx:nginx /opt/PriceyBotPanel/{current,release,shared}");
});

View File

@ -0,0 +1,5 @@
<x-app-layout>
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<livewire:pages.admin.logs/>
</div>
</x-app-layout>

View File

@ -0,0 +1,4 @@
{{-- https://heroicons.com/ --}}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M6.429 9.75L2.25 12l4.179 2.25m0-4.5l5.571 3 5.571-3m-11.142 0L2.25 7.5 12 2.25l9.75 5.25-4.179 2.25m0 0L21.75 12l-4.179 2.25m0 0l4.179 2.25L12 21.75 2.25 16.5l4.179-2.25m11.142 0l-5.571 3-5.571-3" />
</svg>

View File

@ -0,0 +1,106 @@
@if ($paginator->hasPages())
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}" class="flex items-center justify-between">
<div class="flex justify-between flex-1 sm:hidden">
@if ($paginator->onFirstPage())
<span class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md">
{!! __('pagination.previous') !!}
</span>
@else
<a wire:navigate href="{{ $paginator->previousPageUrl() }}" class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">
{!! __('pagination.previous') !!}
</a>
@endif
@if ($paginator->hasMorePages())
<a wire:navigate href="{{ $paginator->nextPageUrl() }}" class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">
{!! __('pagination.next') !!}
</a>
@else
<span class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md">
{!! __('pagination.next') !!}
</span>
@endif
</div>
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
<div>
<p class="text-sm text-nexi-black dark:text-gray-200 leading-5">
{!! __('Showing') !!}
@if ($paginator->firstItem())
<span class="font-medium">{{ $paginator->firstItem() }}</span>
{!! __('to') !!}
<span class="font-medium">{{ $paginator->lastItem() }}</span>
@else
{{ $paginator->count() }}
@endif
{!! __('of') !!}
<span class="font-medium">{{ $paginator->total() }}</span>
{!! __('results') !!}
</p>
</div>
<div>
<span class="relative z-0 inline-flex shadow-sm rounded-md">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<span aria-disabled="true" aria-label="{{ __('pagination.previous') }}">
<span class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md leading-5" aria-hidden="true">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
</svg>
</span>
</span>
@else
<a wire:navigate href="{{ $paginator->previousPageUrl() }}" rel="prev" class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150" aria-label="{{ __('pagination.previous') }}">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
</svg>
</a>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<span aria-disabled="true">
<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 cursor-default leading-5">{{ $element }}</span>
</span>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<span aria-current="page">
<span class="relative bg-nexi-red inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-white border border-nexi-red cursor-default leading-5">{{ $page }}</span>
</span>
@else
<a wire:navigate href="{{ $url }}" class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-nexi-black bg-gray-50 border border-gray-300 leading-5 hover:text-gray-500 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150" aria-label="{{ __('Go to page :page', ['page' => $page]) }}">
{{ $page }}
</a>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<a wire:navigate href="{{ $paginator->nextPageUrl() }}" rel="next" class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150" aria-label="{{ __('pagination.next') }}">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
</svg>
</a>
@else
<span aria-disabled="true" aria-label="{{ __('pagination.next') }}">
<span class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-r-md leading-5" aria-hidden="true">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
</svg>
</span>
</span>
@endif
</span>
</div>
</div>
</nav>
@endif

View File

@ -3,7 +3,7 @@
<a {{ $attributes }} class="
{{ Route::is($route)
? 'text-nexi-red bg-gray-50 dark:bg-zinc-800 transition-colors duration-300'
: 'text-nexi-black dark:text-nexi-grey hover:text-nexi-red dark:hover:text-nexi-red hover:bg-gray-400 dark:hover:bg-zinc-700 transition-colors duration-300' }}
: 'text-nexi-black dark:text-nexi-grey hover:text-nexi-red dark:hover:text-nexi-red hover:bg-gray-100 dark:hover:bg-zinc-700 transition-colors duration-300' }}
group flex gap-x-3 leading-6 items-center p-2 text-base font-medium rounded-md"
wire:navigate>
{{ $svg ?? '' }}

View File

@ -31,7 +31,14 @@
Send Quote
</x-sidebar-nav>
</li>
<li>
<x-sidebar-nav :href="route('admin.logs')" route="admin.logs">
<x-slot:svg><x-icons.square-stack/></x-slot:svg>
Logs
</x-sidebar-nav>
</li>
</ul>
</ul>
</li>
@endif

View File

@ -1,4 +1,4 @@
<div class="sm:fixed sm:top-0 flex flex-row-reverse w-full sm:right-0 p-6 text-right z-10 bg-nexi-primary dark:bg-nexi-primary-dark transition-colors duration-300">
<div class="sm:fixed sm:top-0 flex flex-row-reverse w-full border-b border-gray-200 sm:right-0 p-6 text-right z-10 bg-nexi-primary dark:bg-nexi-primary-dark transition-colors duration-300">
@auth
<div class="pr-6 flex">
<a href="{{ url('/dashboard') }}"

View File

@ -15,7 +15,7 @@ new class extends Component
}
}; ?>
<nav x-data="{ openProfile : false }" class="sticky top-0 z-40 lg:mx-auto lg:max-w-7xl lg:px-8 bg-nexi-primary dark:bg-nexi-primary-dark transition-colors duration-300">
<nav x-data="{ openProfile : false }" class="sticky top-0 z-40 lg:mx-auto lg:px-8 bg-nexi-primary dark:bg-nexi-primary-dark transition-colors duration-300">
<div class="flex h-16 items-center gap-x-4 border-b border-gray-200 px-4 shadow-sm sm:gap-x-6 sm:px-6 lg:px-0 lg:shadow-none">
<button type="button" class="-m-2.5 p-2.5 text-gray-700 lg:hidden" @click="sidebarOpen = true">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">

View File

@ -0,0 +1,88 @@
<?php
use App\Models\Log;
use App\Models\Quote;
use App\Models\RequestedQuote;
use Livewire\Attributes\Layout;
use Livewire\Volt\Component;
use Livewire\WithPagination;
use Spatie\Activitylog\Models\Activity;
new #[Layout('layouts.app')] class extends Component
{
use WithPagination;
public function with(): array
{
$logs = Activity::with(['causer', 'subject'])
->orderByDesc('id')
->paginate(15);
return [
'logs' => $logs,
];
}
}; ?>
<div class="px-4 sm:px-6 lg:px-8">
<div class="-mx-4 mt-10 ring-1 ring-gray-300 sm:mx-0 sm:rounded-lg bg-nexi-primary dark:bg-zinc-800 transition-colors duration-300">
<table class="min-w-full divide-y divide-gray-300">
<thead>
<tr>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-nexi-black dark:text-gray-200 sm:pl-6">
User
</th>
<th scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
Type
</th>
<th scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
Entity ID
</th>
<th scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
Event
</th>
<th scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
Logs
</th>
<th scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
IP
</th>
</tr>
</thead>
<tbody>
@foreach ($logs as $log)
<tr>
<td class="relative py-4 px-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
{{ $log?->causer?->full_name ?? 'Anonymous' }}
</td>
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
{{ str_replace('App\Models\\', '', $log->subject_type) }}
</td>
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
{{ $log->subject_id }}
</td>
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
{{ \Illuminate\Support\Str::headline($log->event) }}
</td>
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
{{ $log->description }}
</td>
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
{{ $log->getExtraProperty('ip') }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="mt-4">
{{ $logs->links('components.paginator') }}
</div>
</div>

View File

@ -1,5 +1,7 @@
<?php
use App\Helpers\Slack;
use App\Models\Log;
use Illuminate\Support\Facades\Http;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Rule;
@ -14,24 +16,27 @@ new #[Layout('layouts.app')] class extends Component
{
$validated = $this->validate();
$response = Http::post(config('bot.webhook'), ['text' => $validated['quote']]);
$slack = new Slack();
$slack->sendText($validated['quote']);
$this->quote = '';
}
}; ?>
<div class="px-4 sm:px-6 lg:px-8">
<form wire:submit="sendQuote">
<x-text-input
wire:model="quote"
placeholder="{{ __('What did he say this time?') }}"
class="block w-full border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm"
class="block w-full text-nexi-black border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm"
></x-text-input>
<x-input-error :messages="$errors->get('quote')" class="mt-2"/>
<x-primary-button wire:loading.attr="disabled"
wire:loading.class="opacity-50"
class="mt-4">{{ __('Send') }}</x-primary-button>
class="mt-4">
{{ __('Send') }}
</x-primary-button>
</form>
</div>

View File

@ -1,5 +1,7 @@
<?php
use App\Models\Log;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Support\Facades\RateLimiter;
@ -39,6 +41,11 @@ new #[Layout('layouts.guest')] class extends Component
session()->regenerate();
activity()
->performedOn(auth()->user())
->event('access')
->log('User logged in');
$this->redirect(
session('url.intended', RouteServiceProvider::HOME),
navigate: true

View File

@ -1,5 +1,7 @@
<?php
use App\Models\User;
use App\Models\Log;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
@ -35,17 +37,20 @@ new #[Layout('layouts.guest')] class extends Component
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$this->only('email', 'password', 'password_confirmation', 'token'),
function ($user) {
$user->forceFill([
'password' => Hash::make($this->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
auth()->user()->update([
$status = Password::reset(
$this->only('email', 'password', 'password_confirmation', 'token'),
function ($user) {
$user->forceFill([
'password' => Hash::make($this->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
]);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
@ -56,6 +61,10 @@ new #[Layout('layouts.guest')] class extends Component
return;
}
activity()
->event('updated')
->log('Password reset');
session()->flash('status', __($status));
$this->redirectRoute('login', navigate: true);

View File

@ -20,7 +20,6 @@ new #[Layout('layouts.guest')] class extends Component
$this->authorize('request', $quote);
$quote->request();
// TODO: add code to send a notification
}
public function delete(Quote $quote): void
@ -64,9 +63,12 @@ new #[Layout('layouts.guest')] class extends Component
@if(auth()->user())
<td class="relative w-8 pl-4 pr-3 text-sm sm:pl-6 border-t">
<div class="flex flex-row space-x-2">
@if(auth()->user()->is_admin)
{{-- For now this is admin only, when we add credits we can make it avaliable to users --}}
<form wire:submit="request({{ $quote }})">
<x-button wire:loading.attr="disabled" wire:loading.class="opacity-50" class="bg-nexi-purple w-24">{{ __('Request') }}</x-button>
</form>
@endif
@if(auth()->user()->is_admin)
<x-button
x-data=""

View File

@ -1,77 +0,0 @@
<?php
use Livewire\Attributes\Rule;
use Livewire\Volt\Component;
new class extends Component
{
#[Rule(['required', 'string', 'current_password'])]
public string $password = '';
public function deleteUser(): void
{
$this->validate();
tap(auth()->user(), fn () => auth()->logout())->delete();
session()->invalidate();
session()->regenerateToken();
$this->redirect('/', navigate: true);
}
}; ?>
<section class="space-y-6">
<header>
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
{{ __('Delete Account') }}
</h2>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.') }}
</p>
</header>
<x-danger-button
x-data=""
x-on:click.prevent="$dispatch('open-modal', 'confirm-user-deletion')"
>{{ __('Delete Account') }}</x-danger-button>
<x-modal name="confirm-user-deletion" :show="$errors->isNotEmpty()" focusable>
<form wire:submit="deleteUser" class="p-6">
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
{{ __('Are you sure you want to delete your account?') }}
</h2>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.') }}
</p>
<div class="mt-6">
<x-input-label for="password" value="{{ __('Password') }}" class="sr-only" />
<x-text-input
wire:model="password"
id="password"
name="password"
type="password"
class="mt-1 block w-3/4"
placeholder="{{ __('Password') }}"
/>
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<div class="mt-6 flex justify-end">
<x-secondary-button x-on:click="$dispatch('close')">
{{ __('Cancel') }}
</x-secondary-button>
<x-danger-button class="ml-3">
{{ __('Delete Account') }}
</x-danger-button>
</div>
</form>
</x-modal>
</section>

View File

@ -1,5 +1,7 @@
<?php
use App\Models\Log;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;
use Illuminate\Validation\ValidationException;
@ -24,9 +26,16 @@ new class extends Component
throw $e;
}
auth()->user()->update([
'password' => Hash::make($validated['password']),
]);
// We don't want to have a complete log, just something for updating password
activity()->withoutLogs(function () {
auth()->user()->update([
'password' => Hash::make($validated['password']),
]);
});
activity()
->event('updated')
->log('Password updated');
$this->reset('current_password', 'password', 'password_confirmation');
@ -47,25 +56,41 @@ new class extends Component
<form wire:submit="updatePassword" class="mt-6 space-y-6">
<div>
<x-input-label for="current_password" :value="__('Current Password')" />
<x-text-input wire:model="current_password" id="current_password" name="current_password" type="password" class="mt-1 block w-full" autocomplete="current-password" />
<x-input-error :messages="$errors->get('current_password')" class="mt-2" />
<x-input-label for="current_password" :value="__('Current Password')"/>
<x-text-input wire:model="current_password"
id="current_password"
name="current_password"
type="password"
class="mt-1 block w-full"
autocomplete="current-password"/>
<x-input-error :messages="$errors->get('current_password')" class="mt-2"/>
</div>
<div>
<x-input-label for="password" :value="__('New Password')" />
<x-text-input wire:model="password" id="password" name="password" type="password" class="mt-1 block w-full" autocomplete="new-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
<x-input-label for="password" :value="__('New Password')"/>
<x-text-input wire:model="password"
id="password"
name="password"
type="password"
class="mt-1 block w-full"
autocomplete="new-password"/>
<x-input-error :messages="$errors->get('password')" class="mt-2"/>
</div>
<div>
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
<x-text-input wire:model="password_confirmation" id="password_confirmation" name="password_confirmation" type="password" class="mt-1 block w-full" autocomplete="new-password" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
<x-input-label for="password_confirmation" :value="__('Confirm Password')"/>
<x-text-input wire:model="password_confirmation"
id="password_confirmation"
name="password_confirmation"
type="password"
class="mt-1 block w-full"
autocomplete="new-password"/>
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2"/>
</div>
<div class="flex items-center gap-4">
<x-primary-button wire:loading.attr="disabled" wire:loading.class="opacity-50">{{ __('Save') }}</x-primary-button>
<x-primary-button wire:loading.attr="disabled"
wire:loading.class="opacity-50">{{ __('Save') }}</x-primary-button>
<x-action-message class="mr-3" on="password-updated">
{{ __('Saved.') }}

View File

@ -1,82 +0,0 @@
<?php
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Validation\Rule;
use Livewire\Volt\Component;
new class extends Component
{
public string $firstname = '';
public string $lastname = '';
public string $email = '';
public function mount(): void
{
$this->firstname = auth()->user()->firstname;
$this->lastname = auth()->user()->lastname;
$this->email = auth()->user()->email;
}
public function updateProfileInformation(): void
{
$user = auth()->user();
$validated = $this->validate([
'firstname' => ['required', 'string', 'max:255'],
'lastname' => ['required', 'string', 'max:255'],
'email' => ['required', 'email', 'max:255', Rule::unique(User::class)->ignore($user->id)],
]);
$user->fill($validated);
if ($user->isDirty('email')) {
$user->email_verified_at = null;
}
$user->save();
$this->dispatch('profile-updated', name: $user->name);
}
}; ?>
<section>
<header>
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
{{ __('Profile Information') }}
</h2>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
{{ __("Update your account's profile information and email address.") }}
</p>
</header>
<form wire:submit="updateProfileInformation" class="mt-6 space-y-6">
<div>
<x-input-label for="firstname" :value="__('FirstName')" />
<x-text-input wire:model="firstname" id="firstname" name="firstname" type="text" class="mt-1 block w-full" required autofocus autocomplete="first" />
<x-input-error class="mt-2" :messages="$errors->get('firstname')" />
</div>
<div>
<x-input-label for="lastname" :value="__('lastname')" />
<x-text-input wire:model="lastname" id="lastname" name="lastname" type="text" class="mt-1 block w-full" required autofocus autocomplete="last" />
<x-input-error class="mt-2" :messages="$errors->get('lastname')" />
</div>
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input wire:model="email" id="email" name="email" type="email" class="mt-1 block w-full" required autocomplete="username" />
<x-input-error class="mt-2" :messages="$errors->get('email')" />
</div>
<div class="flex items-center gap-4">
<x-primary-button wire:loading.attr="disabled" wire:loading.class="opacity-50">{{ __('Save') }}</x-primary-button>
<x-action-message class="mr-3" on="profile-updated">
{{ __('Saved.') }}
</x-action-message>
</div>
</form>
</section>

View File

@ -7,23 +7,11 @@
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
{{-- <div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">--}}
{{-- <div class="max-w-xl">--}}
{{-- <livewire:profile.update-profile-information-form />--}}
{{-- </div>--}}
{{-- </div>--}}
<div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">
<div class="max-w-xl">
<livewire:profile.update-password-form />
</div>
</div>
{{-- <div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">--}}
{{-- <div class="max-w-xl">--}}
{{-- <livewire:profile.delete-user-form />--}}
{{-- </div>--}}
{{-- </div>--}}
</div>
</div>
</x-app-layout>

View File

@ -1,9 +1,8 @@
<?php
use App\Http\Controllers\Api\WebHookController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\WebHookController;
use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
@ -17,7 +16,6 @@ use Illuminate\Http\Request;
*/
Route::middleware(['header.auth', 'throttle:api'])->group(function () {
Route::get('/test', [WebHookController::class, 'test']);
Route::post('/sendQuote', [WebHookController::class, 'sendQuote']);
Route::post('/randomQuote', [WebHookController::class, 'sendRandomQuote']);

View File

@ -30,6 +30,10 @@ Route::middleware(['auth'])->group(function() {
});
});
Route::view('/admin/logs', 'admin.logs')
->middleware(['auth'])
->name('admin.logs');
Route::middleware('guest')->group(function () {
Volt::route('login', 'pages.auth.login')
->name('login');

View File

@ -7,8 +7,7 @@ export default defineConfig({
input: [
'resources/css/app.css',
'resources/js/app.js',
],
refresh: true,
]
}),
splitVendorChunkPlugin()
],