diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 5fbb0bc..18ef5e7 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -35,18 +35,6 @@ class LoginController extends Controller public function showLoginForm() { - return Inertia::render('Auth/Login', [ - 'intendedUrl' => Session::pull('url.intended', URL::route('dashboard')), - ]); - } - - protected function authenticated(Request $request, $user) - { - return Response::json(['success' => true]); - } - - protected function loggedOut(Request $request) - { - return Redirect::route('login'); + return Inertia::render('Auth/Login'); } } diff --git a/app/Http/Controllers/OrganizationsController.php b/app/Http/Controllers/OrganizationsController.php index 7e4e9fa..9129d1e 100644 --- a/app/Http/Controllers/OrganizationsController.php +++ b/app/Http/Controllers/OrganizationsController.php @@ -6,6 +6,8 @@ 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 { @@ -28,7 +30,7 @@ class OrganizationsController extends Controller public function store() { - return Auth::user()->account->organizations()->create( + Auth::user()->account->organizations()->create( Request::validate([ 'name' => ['required', 'max:100'], 'email' => ['nullable', 'max:50', 'email'], @@ -39,7 +41,9 @@ class OrganizationsController extends Controller 'country' => ['nullable', 'max:2'], 'postal_code' => ['nullable', 'max:25'], ]) - )->only('id'); + ); + + return Redirect::route('organizations'); } public function edit(Organization $organization) @@ -75,15 +79,21 @@ class OrganizationsController extends Controller 'postal_code' => ['nullable', 'max:25'], ]) ); + + return Redirect::route('organizations.edit', $organization); } public function destroy(Organization $organization) { $organization->delete(); + + return Redirect::route('organizations.edit', $organization); } public function restore(Organization $organization) { $organization->restore(); + + return Redirect::route('organizations.edit', $organization); } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 0587b22..695d8ea 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -19,6 +19,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, + \App\Http\Middleware\ConvertRedirects::class, ]; /** diff --git a/app/Http/Middleware/ConvertRedirects.php b/app/Http/Middleware/ConvertRedirects.php new file mode 100644 index 0000000..8c669d6 --- /dev/null +++ b/app/Http/Middleware/ConvertRedirects.php @@ -0,0 +1,20 @@ +setStatusCode(303); + } + + return $response; + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ece2401..74b82a8 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Date; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Request; +use Illuminate\Support\Facades\Session; use Illuminate\Support\ServiceProvider; use Illuminate\Pagination\LengthAwarePaginator; @@ -25,6 +26,9 @@ class AppServiceProvider extends ServiceProvider public function register() { Inertia::share('app.name', Config::get('app.name')); + Inertia::share('errors', function () { + return Session::get('errors') ? Session::get('errors')->getBag('default')->getMessages() : (object) []; + }); Inertia::share('auth.user', function () { if (Auth::user()) { return [ diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue index ed54aaf..726df07 100644 --- a/resources/js/Pages/Auth/Login.vue +++ b/resources/js/Pages/Auth/Login.vue @@ -6,16 +6,16 @@

Welcome Back!

- - + +
Forget password? - Login + Login
@@ -24,7 +24,6 @@