Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
- Laravel 9 to 11
- Bootstrap 4 to 5
- replace webpack by Vite
- replace Vue by Livewire
- remove jQuery
- replace CodeMirror by CodeJar
- add Mailverification für Teacher
- add migrations for existing hubs
- add own query builder
- change session store from file to (anonymized) database
- add Laravel Sail
- update readme and /about
- use LaravelLang
- translate missing Strings
- use same gender notation
- Change brand font to Grand Hotel
- inline svg
- syntax highlight in ad.create and ad.show
- remove unused test files and legacy files
  • Loading branch information
wi-wissen committed Jul 2, 2024
1 parent 5e48d8b commit 8dcffc6
Show file tree
Hide file tree
Showing 286 changed files with 9,157 additions and 37,190 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
71 changes: 52 additions & 19 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
APP_NAME=InstaHub
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_DOMAIN=instahub.test
APP_ADMIN_DOMAIN=admin.instahub.test
APP_HUB_DOMAIN={subdomain}.instahub.test
APP_NAME=InstaHub
APP_TIMEZONE=Europe/Berlin
APP_URL=http://localhost
APP_URL_ADMIN=http://admin.localhost
APP_URL_HUB=http://{subdomain}.localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database

APP_COPYRIGHT=wi-wissen.de

DOC_URL=https://wi-wissen.github.io/instahub-doc-de/

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK_CHANNEL=daily
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=instahub
DB_USERNAME=instahub
DB_PASSWORD=changeme
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
SESSION_DRIVER=anonymized_database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=file
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME=InstaHub
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

VITE_APP_NAME="${APP_NAME}"

WORD=achatgrau,ahornrot,agavengruen,alaskagrau,alpinaweiss,altrosa,aluminiumgrau,amarant,amarantrot,amazonasgruen,ameisenrot,ananasgelb,anthrazit,anthrazitgrau,antikgelb,antikrot,antiktuerkis,antikweiss,apfelgruen,aquamarin,aquamarinblau,asphaltgrau,atlantikblau,atlantisblau,azorenblau,azurblau,ballettrosa,bananengelb,basaltgrau,beige,beigerot,betongrau,birkengruen,blattgruen,blau,bleigrau,bluescreenblau,blutorange,blutrot,braun,braunbeige,braunrot,brillantblau,brombeerrot,bronze,burgunderrot,cappuccino,capriblau,carrerarot,cayennerot,cherry,chromgelb,creepergruen,cremeweiss,currygelb,cyan,dahliengelb,delphinblau,diamantblau,diamantgruen,diamantrot,diamantschwarz,dunkelblau,dunkelbraun,dunkelgelb,dunkelgrau,dunkelgruen,dunkellila,dunkelrosa,dunkelrot,eisblau,eisengrau,elefantengrau,elfenbein,enzianblau,erdbeerrot,erikarot,espressobraun,estorilblau,farblos,farngruen,fehengrau,fenstergrau,feuerrot,flamingorosa,flamingorot,flaschengruen,flieder,froschgruen,fruehlingsgruen,fuchsienrot,gelb,gelbgruen,gelblich,gelborange,geraniumrot,giftgruen,gilblich,ginstergelb,gletscherblau,gold,goldbraun,golden,goldgelb,granitgrau,graphitgrau,grasgruen,grau,graubeige,gruen,gruenbeige,gruenlich,guelden,haselnussbraun,heidelbeerblau,hellblau,hellbraun,hellelfenbein,hellgelb,hellgrau,hellgruen,hellrosa,hellrot,hellrotorange,himbeerrot,himmelblau,honiggelb,hummerrot,indianerrot,indigo,indigoblau,indigorot,indischgelb,indischrot,infernorot,inkarnat,italienischrot,jadegruen,jerichorot,johannisbeerrot,kadmiumgelb,kaffeebraun,kamillengelb,kanariengelb,karamellbraun,kardinalrot,karibikblau,karminrot,karminrot,kastanienbraun,kieferngruen,kieselgrau,kirschrot,kiwigruen,khakigrau,khakigruen,kobaltblau,kobaltgruen,koenigsblau,korallenrosa,korallenrot,kornblumenblau,koronagelb,kosmosschwarz,kupferrot,lachsorange,lachsrosa,lachsrot,laubgruen,lavendelblau,lehmbraun,lemongruen,leuchtgelb,leuchthellorange,leuchthellrot,leuchtorange,leuchtrot,lichtblau,lila,limonengruen,lindgruen,lotusrot,magenta,magnolienrosa,magnolienrot,mahagonibraun,mahagonirot,maigruen,maisgelb,marmor,mandelbraun,marineblau,mauritiusblau,mausgrau,meeresgruen,melonengelb,mintgruen,mohnrot,moosgrau,moosgruen,nachtblau,narzissengelb,neapelgelb,neonblau,neongelb,neongruen,neonlila,neonorange,neonpink,neonrosa,neonrot,neontuerkis,neonviolett,nougatbraun,nussbraun,ocker,ockerbraun,ockergelb,ockerrot,olivgelb,olivgrau,olivgruen,orange,orangegelb,orangerot,orchidee,orientrot,oxidrot,ozeanblau,papageirot,paprikarot,papyrus,papyrusweiss,pastell,pastellgelb,pastellorange,patinagruen,pazifikblau,pechrabenschwarz,perlbeige,perlgold,perlgrau,perlorange,perlrosa,perlrubinrot,perlweiss,permamentrosa,permamentrot,persischrot,petrol,pfirsichrot,pigmentgruen,pink,pistaziengruen,platingrau,plazentarot,porzellanblau,pflaumenblau,pumucklrot,purpur,purpurlila,purpurrot,quarzgrau,quittegelb,quittengelb,rapsgelb,rehbraun,reinorange,reinrot,resedagruen,rhabarberrot,rindenbraun,ringelblumengelb,rosa,rosenrosa,rosenrot,rosig,rostbraun,rostrot,rot,rotorange,royalblau,rubinrot,safrangelb,safranrot,saharagelb,sandgelb,sandgelb,sandsteinrot,saphirblau,scharlachrot,schiefergrau,schilfgruen,schneeweiss,schokoladenbraun,schwarz,schwarzbraun,schwarzrot,schwefelgelb,seegruen,seidengrau,sepiabraun,siena,sienabraun,signalgelb,signalorange,signalrot,silber,silbergrau,silbrig,smalteblau,smaragdgruen,sonnengelb,stahlblau,staubgrau,suedseeblau,steingrau,tabakbraun,tannengruen,taubenblau,terrabraun,terracotta,tieforange,tiefschwarz,tintenblau,tintenrot,tintenschwarz,titangrau,tizianrot,tomatenrot,torfbraun,tumblau,tuerkis,tuerkischrot,umbra,universalblau,ultramarinblau,veilchenblau,venezianischrot,violett,walnussbraun,wasserblau,weinrot,weiss,wiesengruen,wuestenrot,xenon,zartgruen,zartrosa,zeltgrau,zementgrau,ziegelrot,zimtbraun,zinkgelb,zinnoberrot,zitronengelb,zitrusgelb,zyan
WORD_NUMBER=100

WORD = achatgrau,ahornrot,agavengruen,alaskagrau,alpinaweiss,altrosa,aluminiumgrau,amarant,amarantrot,amazonasgruen,ameisenrot,ananasgelb,anthrazit,anthrazitgrau,antikgelb,antikrot,antiktuerkis,antikweiss,apfelgruen,aquamarin,aquamarinblau,asphaltgrau,atlantikblau,atlantisblau,azorenblau,azurblau,ballettrosa,bananengelb,basaltgrau,beige,beigerot,betongrau,birkengruen,blattgruen,blau,bleigrau,bluescreenblau,blutorange,blutrot,braun,braunbeige,braunrot,brillantblau,brombeerrot,bronze,burgunderrot,cappuccino,capriblau,carrerarot,cayennerot,cherry,chromgelb,creepergruen,cremeweiss,currygelb,cyan,dahliengelb,delphinblau,diamantblau,diamantgruen,diamantrot,diamantschwarz,dunkelblau,dunkelbraun,dunkelgelb,dunkelgrau,dunkelgruen,dunkellila,dunkelrosa,dunkelrot,eisblau,eisengrau,elefantengrau,elfenbein,enzianblau,erdbeerrot,erikarot,espressobraun,estorilblau,farblos,farngruen,fehengrau,fenstergrau,feuerrot,flamingorosa,flamingorot,flaschengruen,flieder,froschgruen,fruehlingsgruen,fuchsienrot,gelb,gelbgruen,gelblich,gelborange,geraniumrot,giftgruen,gilblich,ginstergelb,gletscherblau,gold,goldbraun,golden,goldgelb,granitgrau,graphitgrau,grasgruen,grau,graubeige,gruen,gruenbeige,gruenlich,guelden,haselnussbraun,heidelbeerblau,hellblau,hellbraun,hellelfenbein,hellgelb,hellgrau,hellgruen,hellrosa,hellrot,hellrotorange,himbeerrot,himmelblau,honiggelb,hummerrot,indianerrot,indigo,indigoblau,indigorot,indischgelb,indischrot,infernorot,inkarnat,italienischrot,jadegruen,jerichorot,johannisbeerrot,kadmiumgelb,kaffeebraun,kamillengelb,kanariengelb,karamellbraun,kardinalrot,karibikblau,karminrot,karminrot,kastanienbraun,kieferngruen,kieselgrau,kirschrot,kiwigruen,khakigrau,khakigruen,kobaltblau,kobaltgruen,koenigsblau,korallenrosa,korallenrot,kornblumenblau,koronagelb,kosmosschwarz,kupferrot,lachsorange,lachsrosa,lachsrot,laubgruen,lavendelblau,lehmbraun,lemongruen,leuchtgelb,leuchthellorange,leuchthellrot,leuchtorange,leuchtrot,lichtblau,lila,limonengruen,lindgruen,lotusrot,magenta,magnolienrosa,magnolienrot,mahagonibraun,mahagonirot,maigruen,maisgelb,marmor,mandelbraun,marineblau,mauritiusblau,mausgrau,meeresgruen,melonengelb,mintgruen,mohnrot,moosgrau,moosgruen,nachtblau,narzissengelb,neapelgelb,neonblau,neongelb,neongruen,neonlila,neonorange,neonpink,neonrosa,neonrot,neontuerkis,neonviolett,nougatbraun,nussbraun,ocker,ockerbraun,ockergelb,ockerrot,olivgelb,olivgrau,olivgruen,orange,orangegelb,orangerot,orchidee,orientrot,oxidrot,ozeanblau,papageirot,paprikarot,papyrus,papyrusweiss,pastell,pastellgelb,pastellorange,patinagruen,pazifikblau,pechrabenschwarz,perlbeige,perlgold,perlgrau,perlorange,perlrosa,perlrubinrot,perlweiss,permamentrosa,permamentrot,persischrot,petrol,pfirsichrot,pigmentgruen,pink,pistaziengruen,platingrau,plazentarot,porzellanblau,pflaumenblau,pumucklrot,purpur,purpurlila,purpurrot,quarzgrau,quittegelb,quittengelb,rapsgelb,rehbraun,reinorange,reinrot,resedagruen,rhabarberrot,rindenbraun,ringelblumengelb,rosa,rosenrosa,rosenrot,rosig,rostbraun,rostrot,rot,rotorange,royalblau,rubinrot,safrangelb,safranrot,saharagelb,sandgelb,sandgelb,sandsteinrot,saphirblau,scharlachrot,schiefergrau,schilfgruen,schneeweiss,schokoladenbraun,schwarz,schwarzbraun,schwarzrot,schwefelgelb,seegruen,seidengrau,sepiabraun,siena,sienabraun,signalgelb,signalorange,signalrot,silber,silbergrau,silbrig,smalteblau,smaragdgruen,sonnengelb,stahlblau,staubgrau,suedseeblau,steingrau,tabakbraun,tannengruen,taubenblau,terrabraun,terracotta,tieforange,tiefschwarz,tintenblau,tintenrot,tintenschwarz,titangrau,tizianrot,tomatenrot,torfbraun,tumblau,tuerkis,tuerkischrot,umbra,universalblau,ultramarinblau,veilchenblau,venezianischrot,violett,walnussbraun,wasserblau,weinrot,weiss,wiesengruen,wuestenrot,xenon,zartgruen,zartrosa,zeltgrau,zementgrau,ziegelrot,zimtbraun,zinkgelb,zinnoberrot,zitronengelb,zitrusgelb,zyan
WORD_NUMBER = 100
# must be set before creating users
ALLOW_PUBLIC_DB_ACCESS=false

ALLOW_PUBLIC_DB_ACCESS=false
# xdebug
SAIL_XDEBUG_MODE=develop,debug,coverage
14 changes: 11 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
20 changes: 15 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
_ide_helper_models.php
_ide_helper.php
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
.env
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
127 changes: 127 additions & 0 deletions app/Console/Commands/MigrateHubs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php

namespace App\Console\Commands;

use App\Facades\RequestHub;
use App\Models\Hub;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;

class MigrateHubs extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'migrate:hubs {--id= : The minimum Hub ID to start from}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Run migrations for all Hubs from /database/migrations/update';

protected $batch;
protected $migrations = [];

/**
* Execute the console command.
*/
public function handle()
{
$this->batch = $this->getNextBatchNumber();
$this->loadMigrations();

$minId = $this->option('id');
$query = Hub::query();

if ($minId) {
$query->where('id', '>=', $minId);
}

$hubs = $query->orderBy('id')->cursor();

if(! count($this->migrations)) {
$this->info('Nothing to migrate.');
return 0;
}

foreach ($hubs as $hub) {
$this->info("Processing Hub ID: {$hub->id}");

RequestHub::setHubDB($hub->id);
$this->runMigrationsForHub($hub);
}

$this->recordExecutedMigrations();

$this->info('All migrations completed.');
}

protected function loadMigrations()
{
$migrationPath = database_path('migrations/update');
$migrationFiles = File::files($migrationPath);
$executedMigrations = $this->getExecutedMigrations();

foreach ($migrationFiles as $file) {
$migrationName = pathinfo($file, PATHINFO_FILENAME);
if (!in_array($migrationName, $executedMigrations)) {
$this->migrations[$migrationName] = $file;
}
}

$this->info("Loaded " . count($this->migrations) . " migrations.");
}

protected function runMigrationsForHub($hub)
{
foreach ($this->migrations as $migrationName => $file) {
$this->info("Running migration: {$migrationName} for Hub ID: {$hub->id}");

try {
$migration = require $file;
$migration->up();

} catch (\Exception $e) {
$this->error("Failed to run migration {$migrationName} for Hub ID {$hub->id}: " . $e->getMessage());
}
}
}

protected function getExecutedMigrations()
{
RequestHub::setDefaultDB();
return DB::table('hub_migrations')
->pluck('migration')
->toArray();
}

protected function getNextBatchNumber()
{
RequestHub::setDefaultDB();
return DB::table('hub_migrations')->max('batch') + 1;
}

protected function recordExecutedMigrations()
{
RequestHub::setDefaultDB();

$this->info("Recording executed migrations...");

$executedMigrations = [];
foreach ($this->migrations as $migrationName => $file) {
$executedMigrations[] = [
'migration' => $migrationName,
'batch' => $this->batch
];
}

DB::table('hub_migrations')->insert($executedMigrations);

$this->info("Recorded " . count($executedMigrations) . " migrations.");
}
}
34 changes: 0 additions & 34 deletions app/Console/Kernel.php

This file was deleted.

41 changes: 0 additions & 41 deletions app/Exceptions/Handler.php

This file was deleted.

4 changes: 2 additions & 2 deletions app/Helpers/HubHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Helpers;

use App\Models\Hub;
use Debugbar;
use Barryvdh\Debugbar\Facades\Debugbar;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;

Expand Down Expand Up @@ -95,7 +95,7 @@ public function isHub()
public function isReadOnly()
{
if ($this->isHub()) {
return (bool) $this->hub->readonly();
return (bool) $this->hub->readonly;
} else {
return false;
}
Expand Down
Loading

0 comments on commit 8dcffc6

Please sign in to comment.