diff --git a/app/Http/Controllers/ContactsController.php b/app/Http/Controllers/ContactsController.php index 835dfc8..2083752 100644 --- a/app/Http/Controllers/ContactsController.php +++ b/app/Http/Controllers/ContactsController.php @@ -7,6 +7,7 @@ use Inertia\Inertia; use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Request; +use Illuminate\Support\Facades\Redirect; class ContactsController extends Controller { @@ -46,7 +47,7 @@ class ContactsController extends Controller public function store() { - return Auth::user()->account->contacts()->create( + Auth::user()->account->contacts()->create( Request::validate([ 'first_name' => ['required', 'max:50'], 'last_name' => ['required', 'max:50'], @@ -61,7 +62,9 @@ class ContactsController extends Controller 'country' => ['nullable', 'max:2'], 'postal_code' => ['nullable', 'max:25'], ]) - )->only('id'); + ); + + return Redirect::route('contacts'); } public function edit(Contact $contact) @@ -107,15 +110,21 @@ class ContactsController extends Controller 'postal_code' => ['nullable', 'max:25'], ]) ); + + return Redirect::route('contacts.edit', $contact); } public function destroy(Contact $contact) { $contact->delete(); + + return Redirect::route('contacts.edit', $contact); } public function restore(Contact $contact) { $contact->restore(); + + return Redirect::route('contacts.edit', $contact); } } diff --git a/app/Http/Controllers/OrganizationsController.php b/app/Http/Controllers/OrganizationsController.php index 9129d1e..45b5df2 100644 --- a/app/Http/Controllers/OrganizationsController.php +++ b/app/Http/Controllers/OrganizationsController.php @@ -6,7 +6,6 @@ use Inertia\Inertia; use App\Organization; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Request; -use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Redirect; class OrganizationsController extends Controller diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 0951b96..a5afc0a 100644 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -7,6 +7,7 @@ use Inertia\Inertia; use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Request; +use Illuminate\Support\Facades\Redirect; class UsersController extends Controller { @@ -37,7 +38,7 @@ class UsersController extends Controller public function store() { - return Auth::user()->account->users()->create( + Auth::user()->account->users()->create( Request::validate([ 'first_name' => ['required', 'max:50'], 'last_name' => ['required', 'max:50'], @@ -45,7 +46,9 @@ class UsersController extends Controller 'password' => ['nullable'], 'owner' => ['required', 'boolean'], ]) - )->only('id'); + ); + + return Redirect::route('users'); } public function edit(User $user) @@ -77,15 +80,21 @@ class UsersController extends Controller if (Request::get('password')) { $user->update(['password' => Request::get('password')]); } + + return Redirect::route('users.edit', $user); } public function destroy(User $user) { $user->delete(); + + return Redirect::route('users.edit', $user); } public function restore(User $user) { $user->restore(); + + return Redirect::route('users.edit', $user); } } diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue index aa7ee4f..cd3e62e 100644 --- a/resources/js/Pages/Auth/Login.vue +++ b/resources/js/Pages/Auth/Login.vue @@ -6,7 +6,7 @@

Welcome Back!

- +