Skip to content

Commit a5063d2

Browse files
authored
Merge pull request #289 from OpenAdministration/shift-163100
Laravel 12.x Shift
2 parents 9c1855e + 737a96b commit a5063d2

File tree

103 files changed

+2216
-1868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2216
-1868
lines changed

.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ APP_KEY=
44
APP_DEBUG=true
55
APP_URL=http://localhost
66

7-
APP_TIMEZONE=Europe/Berlin
87
APP_LOCALE=de
98
APP_FALLBACK_LOCALE=en
109
APP_FAKER_LOCALE=de_DE
1110
APP_MAINTENANCE_DRIVER=file
1211
APP_MAINTENANCE_STORE=database
12+
# PHP_CLI_SERVER_WORKERS=4
13+
1314
BCRYPT_ROUNDS=12
1415

1516
LOG_CHANNEL=stack
@@ -45,7 +46,7 @@ SESSION_DOMAIN=null
4546
#MAIL_PORT=1025
4647
#MAIL_USERNAME=null
4748
#MAIL_PASSWORD=null
48-
#MAIL_ENCRYPTION=null
49+
MAIL_SCHEME=null
4950
#MAIL_FROM_ADDRESS="hello@example.com"
5051
#MAIL_FROM_NAME="${APP_NAME}"
5152

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/public/build
44
/public/storage
55
/storage/*.key
6+
/storage/pail
67
/vendor
78
.env
89
.env.testing
@@ -15,6 +16,7 @@ Homestead.yaml
1516
npm-debug.log
1617
yarn-error.log
1718
/.idea
19+
/.nova
1820
/.vscode
1921
/public/css/app.css
2022
/public/js/app.js

app/Console/Commands/LegacyDeleteBudgetPlan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LegacyDeleteBudgetPlan extends Command
2525
/**
2626
* Execute the console command.
2727
*/
28-
public function handle()
28+
public function handle(): void
2929
{
3030
$hhp = LegacyBudgetPlan::findOrFail($this->argument('id'));
3131
$groups = $hhp->budgetGroups();

app/Console/Commands/LegacyMigrateEncryption.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use forms\projekte\auslagen\AuslagenHandler2;
1010
use Illuminate\Console\Command;
1111
use Illuminate\Contracts\Encryption\DecryptException;
12+
use Illuminate\Support\Env;
1213
use Illuminate\Support\Facades\DB;
1314

1415
class LegacyMigrateEncryption extends Command
@@ -32,7 +33,7 @@ class LegacyMigrateEncryption extends Command
3233
*/
3334
public function handle(): int
3435
{
35-
if (! isset($_ENV['CHAT_PRIVATE_KEY'], $_ENV['CHAT_PUBLIC_KEY'], $_ENV['IBAN_SECRET_KEY'])) {
36+
if (! Env::get('CHAT_PRIVATE_KEY') !== null && Env::get('CHAT_PUBLIC_KEY') !== null && Env::get('IBAN_SECRET_KEY') !== null) {
3637
$this->error('Please set chat private key and public key / IBAN_SECRET_KEY');
3738

3839
return self::FAILURE;
@@ -49,13 +50,13 @@ public function handle(): int
4950
if (str_starts_with($message->text, '$enc$')) {
5051
// old prefix
5152
$text = substr($text, strlen('$enc$'));
52-
$text = ChatHandler::legacyDecryptMessage($text, $_ENV['CHAT_PRIVATE_KEY']);
53+
$text = ChatHandler::legacyDecryptMessage($text, Env::get('CHAT_PRIVATE_KEY'));
5354
$message->text = \Crypt::encryptString($text);
5455
$message->save();
5556
$count++;
5657
} elseif ($message->type === -1) {
5758
// not used productive anymore, was "private message"
58-
$text = ChatHandler::legacyDecryptMessage($text, $_ENV['CHAT_PRIVATE_KEY']);
59+
$text = ChatHandler::legacyDecryptMessage($text, Env::get('CHAT_PRIVATE_KEY'));
5960
$message->text = \Crypt::encryptString($text);
6061
$message->save();
6162
$count++;

app/Console/Commands/StuFisHealth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class StuFisHealth extends Command
2323
/**
2424
* Execute the console command.
2525
*/
26-
public function handle()
26+
public function handle(): void
2727
{
2828
$output = collect([
2929
'version' => config('stufis.version', ''),

app/Http/Controllers/BudgetPlanController.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
use App\Models\Enums\BudgetType;
77
use App\Models\FiscalYear;
88
use Illuminate\Http\RedirectResponse;
9+
use Illuminate\Support\Facades\Gate;
910

1011
class BudgetPlanController extends Controller
1112
{
1213
public function index()
1314
{
14-
$this->authorize('viewAny', BudgetPlan::class);
15+
Gate::authorize('viewAny', BudgetPlan::class);
1516

1617
$years = FiscalYear::orderByDesc('start_date')->get();
1718

@@ -23,7 +24,7 @@ public function index()
2324
public function show(int $plan_id)
2425
{
2526
$plan = BudgetPlan::findOrFail($plan_id);
26-
$this->authorize('view', $plan);
27+
Gate::authorize('view', $plan);
2728
$items = [
2829
BudgetType::INCOME->slug() => $plan->budgetItemsTree(BudgetType::INCOME),
2930
BudgetType::EXPENSE->slug() => $plan->budgetItemsTree(BudgetType::EXPENSE),
@@ -34,7 +35,7 @@ public function show(int $plan_id)
3435

3536
public function create(): RedirectResponse
3637
{
37-
$this->authorize('create', BudgetPlan::class);
38+
Gate::authorize('create', BudgetPlan::class);
3839
$plan = BudgetPlan::create(['state' => 'draft']);
3940
$groups = $plan->budgetItems()->createMany([
4041
['is_group' => 1, 'budget_type' => BudgetType::INCOME, 'position' => 0, 'short_name' => 'E1'],
@@ -51,8 +52,6 @@ public function create(): RedirectResponse
5152
]);
5253
});
5354

54-
return redirect()->route('budget-plan.edit', ['plan_id' => $plan->id]);
55+
return to_route('budget-plan.edit', ['plan_id' => $plan->id]);
5556
}
5657
}
57-
58-

app/Http/Controllers/Controller.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,4 @@
22

33
namespace App\Http\Controllers;
44

5-
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6-
use Illuminate\Foundation\Bus\DispatchesJobs;
7-
use Illuminate\Foundation\Validation\ValidatesRequests;
8-
use Illuminate\Routing\Controller as BaseController;
9-
10-
abstract class Controller extends BaseController
11-
{
12-
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13-
}
5+
abstract class Controller {}

app/Http/Controllers/Legacy/DeleteExpenses.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public function __invoke(int $expense_id)
2020
$userPerm =
2121
AuthHandler::getInstance()->hasGroup('ref-finanzen-hv')
2222
|| $project->creator->id === \Auth::user()->id
23-
|| explode(';', $expense->created)[1] === \Auth::user()->username;
23+
|| explode(';', (string) $expense->created)[1] === \Auth::user()->username;
2424
// authorize state
25-
$deletableState = ! in_array(explode(';', $expense->state)[0], ['instructed', 'booked'], true);
25+
$deletableState = ! in_array(explode(';', (string) $expense->state)[0], ['instructed', 'booked'], true);
2626

2727
if ($userPerm === false || $deletableState === false) {
2828
abort(403);
@@ -53,6 +53,6 @@ public function __invoke(int $expense_id)
5353
});
5454
\DB::commit();
5555

56-
return redirect()->route('legacy.dashboard', ['sub' => 'mygremium']);
56+
return to_route('legacy.dashboard', ['sub' => 'mygremium']);
5757
}
5858
}

app/Http/Controllers/Legacy/DeleteProject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public function __invoke(int $project_id)
2525
$project->posts()->delete();
2626
$project->delete();
2727

28-
return redirect()->route('legacy.dashboard', ['sub' => 'mygremium']);
28+
return to_route('legacy.dashboard', ['sub' => 'mygremium']);
2929
}
3030
}

app/Http/Controllers/Legacy/ExportController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use App\Exports\LegacyBudgetExport;
66
use App\Http\Controllers\Controller;
77
use App\Models\Legacy\LegacyBudgetPlan;
8-
use Carbon\Carbon;
8+
use Illuminate\Support\Facades\Date;
99
use Maatwebsite\Excel\Excel;
1010

1111
class ExportController extends Controller
@@ -18,10 +18,10 @@ public function budgetPlan(int $id, string $filetype)
1818
};
1919
$plan = LegacyBudgetPlan::findOrFail($id);
2020
$today = today()->format('Y-m-d');
21-
$start = Carbon::make($plan->von)?->format('y-m');
22-
$end = Carbon::make($plan->bis)?->format('y-m');
21+
$start = Date::make($plan->von)?->format('y-m');
22+
$end = Date::make($plan->bis)?->format('y-m');
2323
$fileName = "$today HHP $start".($end ? " bis $end" : '').".$filetype";
2424

25-
return (new LegacyBudgetExport($plan))->download($fileName, $writerType);
25+
return new LegacyBudgetExport($plan)->download($fileName, $writerType);
2626
}
2727
}

0 commit comments

Comments
 (0)