From 39bbf53a921639483a90cf8785e63b6eca4262e4 Mon Sep 17 00:00:00 2001 From: Austin Kregel <5355937+austinkregel@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:33:58 -0400 Subject: [PATCH] wip --- app/Console/Commands/BulkScoutImport.php | 5 +- app/Console/Commands/Initialize.php | 6 +- .../Controllers/Spork/BankingController.php | 3 +- .../Controllers/Spork/BatchJobController.php | 12 +- .../Controllers/Spork/DashboardController.php | 2 +- .../Spork/DevelopmentController.php | 2 +- .../Controllers/Spork/LogicController.php | 2 +- app/Models/Article.php | 2 +- app/Models/Credential.php | 2 +- app/Models/Domain.php | 3 +- app/Models/DomainRecord.php | 2 +- app/Models/Finance/Account.php | 3 +- app/Models/Finance/Transaction.php | 2 +- app/Models/Message.php | 2 +- app/Models/Person.php | 2 +- app/Models/Project.php | 2 - app/Models/Research.php | 2 +- app/Models/ShortCode.php | 5 +- app/Models/Thread.php | 2 +- app/Models/Traits/ScopeRelativeSearch.php | 3 +- app/Providers/TelescopeServiceProvider.php | 4 +- app/Services/News/Feeds/AtomFeed.php | 1 + app/Services/SshKeyGeneratorService.php | 4 +- app/Services/SshService.php | 4 +- bootstrap/providers.php | 3 +- config/database.php | 161 +++++++++++++- config/pulse.php | 8 + config/telescope.php | 207 ++++++++++++++++++ .../2024_06_02_212434_create_pulse_tables.php | 2 + ..._213101_create_telescope_entries_table.php | 2 + routes/pages/spork.php | 71 ++++-- 31 files changed, 470 insertions(+), 61 deletions(-) create mode 100644 config/telescope.php diff --git a/app/Console/Commands/BulkScoutImport.php b/app/Console/Commands/BulkScoutImport.php index bcac4f3..01cbd64 100644 --- a/app/Console/Commands/BulkScoutImport.php +++ b/app/Console/Commands/BulkScoutImport.php @@ -1,12 +1,13 @@ getClasses(); - foreach($searchableModels as $model) { + foreach ($searchableModels as $model) { Artisan::call('scout:import', [ 'model' => $model, ]); diff --git a/app/Console/Commands/Initialize.php b/app/Console/Commands/Initialize.php index 3c8d2e2..6e6b86a 100644 --- a/app/Console/Commands/Initialize.php +++ b/app/Console/Commands/Initialize.php @@ -1,5 +1,7 @@ exists()) { $this->info('SSH key already exists'); + return; } @@ -47,7 +51,7 @@ public function handle() 'pub_key_file' => $publicKeyFile, 'private_key' => $privateKey, 'private_key_file' => $privateKeyFile, - 'pass_key' => !empty($passKey) ? encrypt($passKey) : '', + 'pass_key' => ! empty($passKey) ? encrypt($passKey) : '', ], ]); } diff --git a/app/Http/Controllers/Spork/BankingController.php b/app/Http/Controllers/Spork/BankingController.php index 762f053..17dc172 100644 --- a/app/Http/Controllers/Spork/BankingController.php +++ b/app/Http/Controllers/Spork/BankingController.php @@ -16,7 +16,8 @@ public function __invoke() { $accounts = request()->user() ->accounts() - ->with('credential')->get(); + ->with('credential') + ->get(); return Inertia::render('Banking/Index', [ 'title' => 'Banking ', diff --git a/app/Http/Controllers/Spork/BatchJobController.php b/app/Http/Controllers/Spork/BatchJobController.php index 370e7d6..8801b68 100644 --- a/app/Http/Controllers/Spork/BatchJobController.php +++ b/app/Http/Controllers/Spork/BatchJobController.php @@ -1,5 +1,7 @@ whereIn('uuid', json_decode($batch->failed_job_ids, true)) ->orderByDesc('failed_at') ->get() - ->map(function ($job) { - $job->parsed_exception = (new Stacktrace)->parse($job->exception); - $job->payload = json_decode($job->payload, true); + ->map(function ($job) { + $job->parsed_exception = (new Stacktrace)->parse($job->exception); + $job->payload = json_decode($job->payload, true); - return $job; - }); + return $job; + }); $batch->failed_at = $batch->jobs->max('failed_at'); return $batch; diff --git a/app/Http/Controllers/Spork/DashboardController.php b/app/Http/Controllers/Spork/DashboardController.php index be75cec..41c93b0 100644 --- a/app/Http/Controllers/Spork/DashboardController.php +++ b/app/Http/Controllers/Spork/DashboardController.php @@ -6,7 +6,6 @@ use App\Http\Controllers\Controller; use App\Models\JobBatch; -use App\Models\Person; use App\Models\User; use Illuminate\Support\Arr; use Illuminate\Support\Collection; @@ -27,6 +26,7 @@ public function __invoke() ->selectRaw('max(failed_at)') ->whereIn('id', $batchJob->failed_job_ids) ->value('failed_at'); + return $batchJob; }, $batchJobs->items())) ); diff --git a/app/Http/Controllers/Spork/DevelopmentController.php b/app/Http/Controllers/Spork/DevelopmentController.php index 246e878..0a1c4a0 100644 --- a/app/Http/Controllers/Spork/DevelopmentController.php +++ b/app/Http/Controllers/Spork/DevelopmentController.php @@ -11,7 +11,7 @@ class DevelopmentController public function index() { return Inertia::render('Development/Index', [ -// 'instances' => LaravelProgrammingStyle::instancesOf(CustomAction::class), + // 'instances' => LaravelProgrammingStyle::instancesOf(CustomAction::class), ]); } } diff --git a/app/Http/Controllers/Spork/LogicController.php b/app/Http/Controllers/Spork/LogicController.php index bdedb09..bb9403b 100644 --- a/app/Http/Controllers/Spork/LogicController.php +++ b/app/Http/Controllers/Spork/LogicController.php @@ -11,7 +11,7 @@ class LogicController public function __invoke() { return Inertia::render('Logic/Index', [ - 'container_bindings' => \App\Services\Programming\LaravelProgrammingStyle::findContainerBindings(), + // 'container_bindings' => \App\Services\Programming\LaravelProgrammingStyle::findContainerBindings(), 'events' => \App\Services\Programming\LaravelProgrammingStyle::findLogicalEvents(), 'listeners' => \App\Services\Programming\LaravelProgrammingStyle::findLogicalListeners(), ]); diff --git a/app/Models/Article.php b/app/Models/Article.php index 4b1a675..b91f10c 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -24,10 +24,10 @@ class Article extends Model implements Crud { use HasFactory; - use Searchable; use LogsActivity; use ScopeQSearch; use ScopeRelativeSearch; + use Searchable; public $fillable = [ 'uuid', diff --git a/app/Models/Credential.php b/app/Models/Credential.php index 25e8ab1..a3de111 100644 --- a/app/Models/Credential.php +++ b/app/Models/Credential.php @@ -161,7 +161,7 @@ public function getPrivateKey(): string public function getPasskey(): string { - return empty($this->settings['pass_key'] ?? '') ? '': decrypt($this->settings['pass_key'] ?? ''); + return empty($this->settings['pass_key'] ?? '') ? '' : decrypt($this->settings['pass_key'] ?? ''); } public function getActivitylogOptions(): LogOptions diff --git a/app/Models/Domain.php b/app/Models/Domain.php index afdcea2..613f3fe 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -28,10 +28,10 @@ class Domain extends Model implements Crud, ModelQuery, Taggable use HasFactory; use HasProjectResource; use HasTags; - use Searchable; use LogsActivity; use ScopeQSearch; use ScopeRelativeSearch; + use Searchable; public $fillable = ['name', 'verification_key', 'cloudflare_id', 'domain_id', 'registered_at']; @@ -43,6 +43,7 @@ class Domain extends Model implements Crud, ModelQuery, Taggable 'updating' => DomainUpdating::class, 'updated' => DomainUpdated::class, ]; + // add a global scope to prevent the querying of expired domains protected static function booted() { diff --git a/app/Models/DomainRecord.php b/app/Models/DomainRecord.php index 509c27a..f215cb8 100644 --- a/app/Models/DomainRecord.php +++ b/app/Models/DomainRecord.php @@ -24,9 +24,9 @@ class DomainRecord extends Model implements Crud, ModelQuery { use HasFactory; use LogsActivity; - use Searchable; use ScopeQSearch; use ScopeRelativeSearch; + use Searchable; protected $fillable = [ 'name', diff --git a/app/Models/Finance/Account.php b/app/Models/Finance/Account.php index b2945d3..17c6261 100644 --- a/app/Models/Finance/Account.php +++ b/app/Models/Finance/Account.php @@ -25,10 +25,10 @@ class Account extends Model implements Crud { use HasFactory; - use Searchable; use LogsActivity; use ScopeQSearch; use ScopeRelativeSearch; + use Searchable; protected $fillable = [ 'account_id', @@ -61,7 +61,6 @@ public function transactions(): HasMany return $this->hasMany(Transaction::class); } - public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() diff --git a/app/Models/Finance/Transaction.php b/app/Models/Finance/Transaction.php index 0e48fca..a0989fa 100644 --- a/app/Models/Finance/Transaction.php +++ b/app/Models/Finance/Transaction.php @@ -26,10 +26,10 @@ class Transaction extends Model implements Crud, ModelQuery, Taggable { use HasFactory; - use Searchable; use HasTags; use ScopeQSearch; use ScopeRelativeSearch; + use Searchable; public $fillable = [ 'name', diff --git a/app/Models/Message.php b/app/Models/Message.php index 0917af2..c2b5fb7 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -23,8 +23,8 @@ /** @mixin \Eloquent */ class Message extends Model implements Taggable { - use Searchable; use HasFactory, HasJsonRelationships, HasTags; + use Searchable; public $fillable = [ 'from_person', diff --git a/app/Models/Person.php b/app/Models/Person.php index 085edfc..f5fe107 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -20,8 +20,8 @@ class Person extends Model implements Crud, ModelQuery { use HasFactory; - use Searchable; use ScopeRelativeSearch; + use Searchable; public $guarded = []; diff --git a/app/Models/Project.php b/app/Models/Project.php index aff2140..f4710f5 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -13,14 +13,12 @@ use App\Events\Models\Project\ProjectUpdating; use App\Models\Traits\ScopeQSearch; use App\Models\Traits\ScopeRelativeSearch; -use App\Services\SshKeyGeneratorService; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphToMany; -use Illuminate\Support\Str; use Spatie\Activitylog\LogOptions; use Spatie\Activitylog\Traits\LogsActivity; use Spatie\Tags\HasTags; diff --git a/app/Models/Research.php b/app/Models/Research.php index 30c08f7..c2a199f 100644 --- a/app/Models/Research.php +++ b/app/Models/Research.php @@ -23,9 +23,9 @@ class Research extends Model implements Crud { use HasFactory; use LogsActivity; - use Searchable; use ScopeQSearch; use ScopeRelativeSearch; + use Searchable; public $fillable = ['topic', 'notes', 'sources']; diff --git a/app/Models/ShortCode.php b/app/Models/ShortCode.php index 6aa5ea1..600694c 100644 --- a/app/Models/ShortCode.php +++ b/app/Models/ShortCode.php @@ -15,14 +15,15 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; + //use Laravel\Scout\Searchable; class ShortCode extends Model implements Crud { -// use Searchable; + // use Searchable; use HasFactory; - use ScopeRelativeSearch; use ScopeQSearch; + use ScopeRelativeSearch; public $fillable = [ 'short_code', diff --git a/app/Models/Thread.php b/app/Models/Thread.php index d02e94c..30a570d 100644 --- a/app/Models/Thread.php +++ b/app/Models/Thread.php @@ -21,10 +21,10 @@ class Thread extends Model implements Crud { - use Searchable; use HasFactory; use ScopeQSearch; use ScopeRelativeSearch; + use Searchable; public $casts = ['settings' => 'json', 'origin_server_ts' => 'datetime']; diff --git a/app/Models/Traits/ScopeRelativeSearch.php b/app/Models/Traits/ScopeRelativeSearch.php index 5a5e899..a4ca15b 100644 --- a/app/Models/Traits/ScopeRelativeSearch.php +++ b/app/Models/Traits/ScopeRelativeSearch.php @@ -23,7 +23,6 @@ public function scopeRelative(Builder $query, string $string): void $query->where('user_id', auth()->id()); }); } elseif (method_exists($this, 'credential')) { - $query->whereHas('credential', function (Builder $query) { $query->where('user_id', auth()->id()); }); @@ -48,7 +47,7 @@ public function scopeRelative(Builder $query, string $string): void $query->whereHas('projects.team', function (Builder $query) { $query->where('user_id', auth()->id()); }); - }else { + } else { abort(400, 'No user relation found for model'); } } diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php index 847dd75..7299c17 100644 --- a/app/Providers/TelescopeServiceProvider.php +++ b/app/Providers/TelescopeServiceProvider.php @@ -1,5 +1,7 @@ hideSensitiveRequestDetails(); diff --git a/app/Services/News/Feeds/AtomFeed.php b/app/Services/News/Feeds/AtomFeed.php index cc920c0..43ae43b 100644 --- a/app/Services/News/Feeds/AtomFeed.php +++ b/app/Services/News/Feeds/AtomFeed.php @@ -74,6 +74,7 @@ public function getData(): array $feedItem->url = $post['link']['@attributes']['href']; } else { info('no link', ['context' => $post]); + return $feedItem; } diff --git a/app/Services/SshKeyGeneratorService.php b/app/Services/SshKeyGeneratorService.php index 6174f04..8fea2ff 100644 --- a/app/Services/SshKeyGeneratorService.php +++ b/app/Services/SshKeyGeneratorService.php @@ -4,9 +4,7 @@ namespace App\Services; -use Exception; use phpseclib3\Crypt\EC; -use phpseclib3\Crypt\RSA; class SshKeyGeneratorService { @@ -18,7 +16,7 @@ public static function generate( ) { $key = EC::createKey('ed25519'); - if (!empty($passKey)) { + if (! empty($passKey)) { $key->withPassword($passKey); } diff --git a/app/Services/SshService.php b/app/Services/SshService.php index f84524c..b8de03a 100644 --- a/app/Services/SshService.php +++ b/app/Services/SshService.php @@ -83,7 +83,7 @@ public function run(Script $script, string $directory = ''): array unlink($localFilePath); try { // Run a command that will probably write to stderr (unless you have a folder named /hom) - $stream_out = ssh2_exec($this->connection, 'bash ' . escapeshellcmd($file). ' 2>&1'); + $stream_out = ssh2_exec($this->connection, 'bash '.escapeshellcmd($file).' 2>&1'); stream_set_blocking($stream_out, true); $stream_error = ssh2_fetch_stream($stream_out, SSH2_STREAM_STDERR); @@ -91,7 +91,7 @@ public function run(Script $script, string $directory = ''): array } catch (\Throwable $e) { return [ 'stdout' => '', - 'stderr' => $e->getMessage() . "\n" . $e->getTraceAsString(), + 'stderr' => $e->getMessage()."\n".$e->getTraceAsString(), ]; } diff --git a/bootstrap/providers.php b/bootstrap/providers.php index abc8459..c71d096 100644 --- a/bootstrap/providers.php +++ b/bootstrap/providers.php @@ -4,8 +4,9 @@ return [ App\Providers\AppServiceProvider::class, - App\Providers\HorizonServiceProvider::class, App\Providers\FortifyServiceProvider::class, + App\Providers\HorizonServiceProvider::class, App\Providers\JetstreamServiceProvider::class, App\Providers\OperationServiceProvider::class, + App\Providers\TelescopeServiceProvider::class, ]; diff --git a/config/database.php b/config/database.php index b23635d..6bdba53 100644 --- a/config/database.php +++ b/config/database.php @@ -2,11 +2,170 @@ declare(strict_types=1); +use Illuminate\Support\Str; + return [ + /* + |-------------------------------------------------------------------------- + | Default Database Connection Name + |-------------------------------------------------------------------------- + | + | Here you may specify which of the database connections below you wish + | to use as your default connection for database operations. This is + | the connection which will be utilized unless another connection + | is explicitly specified when you execute a query / statement. + | + */ + + 'default' => env('DB_CONNECTION', 'sqlite'), + + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Below are all of the database connections defined for your application. + | An example configuration is provided for each database system which + | is supported by Laravel. You're free to add / remove connections. + | + */ + + 'connections' => [ + + 'sqlite' => [ + 'driver' => 'sqlite', + 'url' => env('DB_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), + ], + + 'mysql' => [ + 'driver' => 'mysql', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], + + 'mariadb' => [ + 'driver' => 'mariadb', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], + + 'pgsql' => [ + 'driver' => 'pgsql', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => env('DB_CHARSET', 'utf8'), + 'prefix' => '', + 'prefix_indexes' => true, + 'search_path' => 'public', + 'sslmode' => 'prefer', + ], + + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => env('DB_CHARSET', 'utf8'), + 'prefix' => '', + 'prefix_indexes' => true, + // 'encrypt' => env('DB_ENCRYPT', 'yes'), + // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run on the database. + | + */ + 'migrations' => [ 'table' => 'migrations', - 'update_date_on_publish' => false, // disable to preserve original behavior for existing applications + 'update_date_on_publish' => true, ], + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer body of commands than a typical key-value system + | such as Memcached. You may define your connection settings here. + | + */ + + 'redis' => [ + + 'client' => env('REDIS_CLIENT', 'phpredis'), + + 'options' => [ + 'cluster' => env('REDIS_CLUSTER', 'redis'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + ], + + 'default' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_DB', '0'), + ], + + 'cache' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_CACHE_DB', '1'), + ], + + ], ]; diff --git a/config/pulse.php b/config/pulse.php index 528085c..a264c65 100644 --- a/config/pulse.php +++ b/config/pulse.php @@ -225,5 +225,13 @@ '#^/pulse$#', // Pulse dashboard... ], ], + + \Laravel\Reverb\Pulse\Recorders\ReverbConnections::class => [ + 'sample_rate' => 1, + ], + + \Laravel\Reverb\Pulse\Recorders\ReverbMessages::class => [ + 'sample_rate' => 1, + ], ], ]; diff --git a/config/telescope.php b/config/telescope.php new file mode 100644 index 0000000..990d5c7 --- /dev/null +++ b/config/telescope.php @@ -0,0 +1,207 @@ + env('TELESCOPE_ENABLED', true), + + /* + |-------------------------------------------------------------------------- + | Telescope Domain + |-------------------------------------------------------------------------- + | + | This is the subdomain where Telescope will be accessible from. If the + | setting is null, Telescope will reside under the same domain as the + | application. Otherwise, this value will be used as the subdomain. + | + */ + + 'domain' => env('TELESCOPE_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Telescope Path + |-------------------------------------------------------------------------- + | + | This is the URI path where Telescope will be accessible from. Feel free + | to change this path to anything you like. Note that the URI will not + | affect the paths of its internal API that aren't exposed to users. + | + */ + + 'path' => env('TELESCOPE_PATH', 'telescope'), + + /* + |-------------------------------------------------------------------------- + | Telescope Storage Driver + |-------------------------------------------------------------------------- + | + | This configuration options determines the storage driver that will + | be used to store Telescope's data. In addition, you may set any + | custom options as needed by the particular driver you choose. + | + */ + + 'driver' => env('TELESCOPE_DRIVER', 'database'), + + 'storage' => [ + 'database' => [ + 'connection' => env('DB_CONNECTION', 'mysql'), + 'chunk' => 1000, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Queue + |-------------------------------------------------------------------------- + | + | This configuration options determines the queue connection and queue + | which will be used to process ProcessPendingUpdate jobs. This can + | be changed if you would prefer to use a non-default connection. + | + */ + + 'queue' => [ + 'connection' => env('TELESCOPE_QUEUE_CONNECTION', null), + 'queue' => env('TELESCOPE_QUEUE', null), + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Route Middleware + |-------------------------------------------------------------------------- + | + | These middleware will be assigned to every Telescope route, giving you + | the chance to add your own middleware to this list or change any of + | the existing middleware. Or, you can simply stick with this list. + | + */ + + 'middleware' => [ + 'web', + Authorize::class, + ], + + /* + |-------------------------------------------------------------------------- + | Allowed / Ignored Paths & Commands + |-------------------------------------------------------------------------- + | + | The following array lists the URI paths and Artisan commands that will + | not be watched by Telescope. In addition to this list, some Laravel + | commands, like migrations and queue commands, are always ignored. + | + */ + + 'only_paths' => [ + // 'api/*' + ], + + 'ignore_paths' => [ + 'livewire*', + 'nova-api*', + 'pulse*', + ], + + 'ignore_commands' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Watchers + |-------------------------------------------------------------------------- + | + | The following array lists the "watchers" that will be registered with + | Telescope. The watchers gather the application's profile data when + | a request or task is executed. Feel free to customize this list. + | + */ + + 'watchers' => [ + Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true), + + Watchers\CacheWatcher::class => [ + 'enabled' => env('TELESCOPE_CACHE_WATCHER', true), + 'hidden' => [], + ], + + Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), + + Watchers\CommandWatcher::class => [ + 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), + 'ignore' => [], + ], + + Watchers\DumpWatcher::class => [ + 'enabled' => env('TELESCOPE_DUMP_WATCHER', true), + 'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false), + ], + + Watchers\EventWatcher::class => [ + 'enabled' => env('TELESCOPE_EVENT_WATCHER', true), + 'ignore' => [], + ], + + Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), + + Watchers\GateWatcher::class => [ + 'enabled' => env('TELESCOPE_GATE_WATCHER', true), + 'ignore_abilities' => [], + 'ignore_packages' => true, + 'ignore_paths' => [], + ], + + Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), + + Watchers\LogWatcher::class => [ + 'enabled' => env('TELESCOPE_LOG_WATCHER', true), + 'level' => 'error', + ], + + Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), + + Watchers\ModelWatcher::class => [ + 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), + 'events' => ['eloquent.*'], + 'hydrations' => true, + ], + + Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), + + Watchers\QueryWatcher::class => [ + 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), + 'ignore_packages' => true, + 'ignore_paths' => [], + 'slow' => 100, + ], + + Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), + + Watchers\RequestWatcher::class => [ + 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), + 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), + 'ignore_http_methods' => [], + 'ignore_status_codes' => [], + ], + + Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), + Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true), + ], +]; diff --git a/database/migrations/2024_06_02_212434_create_pulse_tables.php b/database/migrations/2024_06_02_212434_create_pulse_tables.php index 5d194e2..c5f53c3 100644 --- a/database/migrations/2024_06_02_212434_create_pulse_tables.php +++ b/database/migrations/2024_06_02_212434_create_pulse_tables.php @@ -1,5 +1,7 @@ Route::has('login'), - 'canRegister' => Route::has('register'), - 'laravelVersion' => Application::VERSION, - 'phpVersion' => PHP_VERSION, - ]); -})->name('welcome'); Route::middleware([ 'auth:sanctum', config('jetstream.auth_session'), @@ -66,13 +59,50 @@ Route::post('/api/projects/{project}/tasks', Controllers\Api\Projects\CreateTaskController::class); + Route::get('/user/api-query', Controllers\User\ApiQueryController::class)->middleware(\Illuminate\Auth\Middleware\Authenticate::class)->name('user.api-query'); +}); + +Route::prefix('-')->middleware('auth:sanctum', config('jetstream.auth_session'), 'verified')->group(function () { + Route::get('/dashboard', Controllers\Spork\DashboardController::class)->name('dashboard'); + Route::get('/search', function () { + $client = new \Meilisearch\Client( + config('scout.meilisearch.host'), + config('scout.meilisearch.key'), + ); + + $searchableModels = Code::instancesOf(Searchable::class)->getClasses(); + + $result = $client->multiSearch(array_map(function ($model) { + return (new \Meilisearch\Contracts\SearchQuery()) + ->setQuery(request('q')) + ->setLimit(4) + ->setIndexUid((new $model)->searchableAs()); + }, $searchableModels)); + + return Inertia::render('Search', [ + 'results' => array_values(array_filter($result['results'], fn ($r) => count($r['hits']) > 0)), + ]); + })->name('search'); + Route::get('/notifications', fn () => Inertia::render('Notifications')); + + Route::get('/rss-feed', fn () => Inertia::render('RssFeeds/Index', [ + 'feeds' => \App\Models\Article::query()->latest('last_modified') + ->with('author.tags') + ->paginate() + ->items(), + 'pagination' => \App\Models\Article::query()->latest('last_modified') + ->with('author.tags') + ->paginate(), + ])); + Route::get('/batch-jobs', [Controllers\Spork\BatchJobController::class, 'index'])->name('batch-jobs.index'); + Route::get('/batch-jobs/{batch_job}', [Controllers\Spork\BatchJobController::class, 'show'])->name('batch-jobs.show'); + Route::get('/projects', [Controllers\Spork\ProjectsController::class, 'index'])->name('projects.index'); + Route::get('/projects/{project}', [Controllers\Spork\ProjectsController::class, 'show'])->name('projects.show'); Route::get('/pages/create', [Controllers\Spork\PagesController::class, 'create'])->name('pages'); Route::get('/servers/{server}', [Controllers\Spork\ServersController::class, 'show'])->name('servers.show'); Route::get('/domains/{domain}', [Controllers\Spork\DomainsController::class, 'show'])->name('domains.show'); - Route::get('/user/api-query', Controllers\User\ApiQueryController::class)->middleware(\Illuminate\Auth\Middleware\Authenticate::class)->name('user.api-query'); - Route::post('project/{project}/deploy', [Controllers\Spork\ProjectsController::class, 'deploy'])->name('project.deploy'); Route::post('project/{project}/attach', [Controllers\Spork\ProjectsController::class, 'attach']) @@ -80,16 +110,7 @@ Route::post('project/{project}/detach', [Controllers\Spork\ProjectsController::class, 'detach']) ->name('project.detach'); -}); - -Route::prefix('-')->middleware('auth:sanctum', config('jetstream.auth_session'), 'verified')->group(function () { - Route::get('/dashboard', Controllers\Spork\DashboardController::class)->name('dashboard'); - Route::get('/notifications', function () { - return \Inertia\Inertia::render('Notifications'); - }); - Route::get('/projects', [Controllers\Spork\ProjectsController::class, 'index'])->name('projects.index'); - Route::get('/projects/{project}', [Controllers\Spork\ProjectsController::class, 'show'])->name('projects.show'); Route::get('/banking', Controllers\Spork\BankingController::class)->name('banking.index'); Route::get('/file-manager', Controllers\Spork\FileManagerController::class)->name('file-manager.index'); @@ -114,8 +135,8 @@ } }); - Route::get('/inbox', [Controllers\Spork\InboxController::class, 'index']); - Route::get('/inbox/{message}', [Controllers\Spork\InboxController::class, 'show']); + Route::get('/inbox', [Controllers\Spork\MessageController::class, 'index'])->name('inbox'); + Route::get('/inbox/{message}', [Controllers\Spork\MessageController::class, 'show'])->name('inbox.show'); Route::get('/manage/{link}', [Controllers\Spork\ManageController::class, 'show'])->name('crud.show'); Route::get('/manage', [Controllers\Spork\ManageController::class, 'index']); @@ -123,13 +144,15 @@ Route::get('/settings', Controllers\Spork\SettingsController::class); Route::get('/tag-manager', Controllers\Spork\TagManagerController::class); - Route::get('/postal', [Controllers\Spork\MessageController::class, 'index'])->name('postal.index'); - Route::get('/postal/{thread}', [Controllers\Spork\MessageController::class, 'show'])->name('postal.show'); + Route::get('/postal', [Controllers\Spork\InboxController::class, 'index'])->name('postal.index'); + Route::get('/postal/{message}', [Controllers\Spork\InboxController::class, 'show'])->name('postal.show'); Route::get('/research', [Controllers\Spork\ResearchController::class, 'index'])->name('research.index'); Route::get('/research/{research}', [Controllers\Spork\ResearchController::class, 'show'])->name('research.show'); Route::get('/projects/create', [Controllers\Spork\ProjectsController::class, 'create']); + + Route::get('/development', [Controllers\Spork\DevelopmentController::class, 'index'])->name('development.index'); }); Route::middleware([