Skip to content

Commit eac67d0

Browse files
authored
Layout changes (#53)
* Rename `HomeController` to `DashboardController` * Remove Guest Vue layout * Add utility classes for labels and input fields * Change `User::currentOrganisation()` to `User::organisation()` * Update HomeControllerTest.php * Update RegisterControllerTest.php * Update Composer dependencies * Update NPM packages * Update Vite to v5
1 parent 57df433 commit eac67d0

30 files changed

+442
-439
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
class DashboardController extends Controller
6+
{
7+
public function index()
8+
{
9+
return \inertia('Dashboard/Index');
10+
}
11+
}

app/Http/Controllers/HomeController.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/Http/Controllers/OrganisationController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ class OrganisationController extends Controller
1111
public function edit(OrganisationEdit $request)
1212
{
1313
return \inertia('Organisation/Edit', [
14-
'organisation' => OrganisationResource::make($request->user()->currentOrganisation),
14+
'organisation' => OrganisationResource::make($request->user()->organisation),
1515
]);
1616
}
1717

1818
public function update(OrganisationUpdate $request)
1919
{
20-
$request->user()->currentOrganisation->update($request->only('name'));
20+
$request->user()->organisation->update($request->only('name'));
2121

2222
\session()->flash('message', \__('organisation.updated'));
2323

app/Http/Controllers/RegisterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function store(RegisterStore $request)
3131
'name' => $request->validated('organisation_name'),
3232
]);
3333
$org->users()->attach($user);
34-
$user->currentOrganisation()->associate($org)->save();
34+
$user->organisation()->associate($org)->save();
3535

3636
$user->assignRole(Role::USER->value);
3737

app/Http/Middleware/HandleInertiaRequests.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function share(Request $request): array
1212
{
1313
return \array_merge(parent::share($request), [
1414
'auth' => [
15+
'loggedIn' => \auth()->check(),
1516
'user' => $request->user() ? UserResource::make($request->user()) : [],
1617
],
1718
'message' => $request->session()->get('message'),

app/Http/Requests/Organisation/OrganisationEdit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ class OrganisationEdit extends FormRequest
99
{
1010
public function authorize()
1111
{
12-
return Gate::allows('edit', $this->user()->currentOrganisation);
12+
return Gate::allows('edit', $this->user()->organisation);
1313
}
1414
}

app/Http/Requests/Organisation/OrganisationUpdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class OrganisationUpdate extends FormRequest
99
{
1010
public function authorize()
1111
{
12-
return Gate::allows('update', $this->user()->currentOrganisation);
12+
return Gate::allows('update', $this->user()->organisation);
1313
}
1414

1515
public function rules()

app/Models/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function organisations()
6363
return $this->belongsToMany(Organisation::class)->withTimestamps();
6464
}
6565

66-
public function currentOrganisation()
66+
public function organisation()
6767
{
6868
return $this->belongsTo(Organisation::class);
6969
}

app/Policies/OrganisationPolicy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class OrganisationPolicy
1010
{
1111
public function edit(User $user, Organisation $organisation)
1212
{
13-
return $user->can(Permission::EDIT_ORGANISATION->value) && $user->currentOrganisation->is($organisation);
13+
return $user->can(Permission::EDIT_ORGANISATION->value) && $user->organisation->is($organisation);
1414
}
1515

1616
public function update(User $user, Organisation $organisation)
1717
{
18-
return $user->can(Permission::UPDATE_ORGANISATION->value) && $user->currentOrganisation->is($organisation);
18+
return $user->can(Permission::UPDATE_ORGANISATION->value) && $user->organisation->is($organisation);
1919
}
2020
}

bun.lockb

-10.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)