diff --git a/app/Http/Controllers/ContactsController.php b/app/Http/Controllers/ContactsController.php
index 2083752..88f8653 100644
--- a/app/Http/Controllers/ContactsController.php
+++ b/app/Http/Controllers/ContactsController.php
@@ -64,7 +64,7 @@ class ContactsController extends Controller
])
);
- return Redirect::route('contacts');
+ return Redirect::route('contacts')->with('success', 'Contact created.');
}
public function edit(Contact $contact)
@@ -111,20 +111,20 @@ class ContactsController extends Controller
])
);
- return Redirect::route('contacts.edit', $contact);
+ return Redirect::route('contacts.edit', $contact)->with('success', 'Contact updated.');
}
public function destroy(Contact $contact)
{
$contact->delete();
- return Redirect::route('contacts.edit', $contact);
+ return Redirect::route('contacts.edit', $contact)->with('success', 'Contact deleted.');
}
public function restore(Contact $contact)
{
$contact->restore();
- return Redirect::route('contacts.edit', $contact);
+ return Redirect::route('contacts.edit', $contact)->with('success', 'Contact restored.');
}
}
diff --git a/app/Http/Controllers/OrganizationsController.php b/app/Http/Controllers/OrganizationsController.php
index 45b5df2..06ce57a 100644
--- a/app/Http/Controllers/OrganizationsController.php
+++ b/app/Http/Controllers/OrganizationsController.php
@@ -42,7 +42,7 @@ class OrganizationsController extends Controller
])
);
- return Redirect::route('organizations');
+ return Redirect::route('organizations')->with('success', 'Organization created.');
}
public function edit(Organization $organization)
@@ -79,20 +79,20 @@ class OrganizationsController extends Controller
])
);
- return Redirect::route('organizations.edit', $organization);
+ return Redirect::route('organizations.edit', $organization)->with('success', 'Organization updated.');
}
public function destroy(Organization $organization)
{
$organization->delete();
- return Redirect::route('organizations.edit', $organization);
+ return Redirect::route('organizations.edit', $organization)->with('success', 'Organization deleted.');
}
public function restore(Organization $organization)
{
$organization->restore();
- return Redirect::route('organizations.edit', $organization);
+ return Redirect::route('organizations.edit', $organization)->with('success', 'Organization restored.');
}
}
diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php
index a5afc0a..235dc87 100644
--- a/app/Http/Controllers/UsersController.php
+++ b/app/Http/Controllers/UsersController.php
@@ -48,7 +48,7 @@ class UsersController extends Controller
])
);
- return Redirect::route('users');
+ return Redirect::route('users')->with('success', 'User created.');
}
public function edit(User $user)
@@ -81,20 +81,20 @@ class UsersController extends Controller
$user->update(['password' => Request::get('password')]);
}
- return Redirect::route('users.edit', $user);
+ return Redirect::route('users.edit', $user)->with('success', 'User updated.');
}
public function destroy(User $user)
{
$user->delete();
- return Redirect::route('users.edit', $user);
+ return Redirect::route('users.edit', $user)->with('success', 'User deleted.');
}
public function restore(User $user)
{
$user->restore();
- return Redirect::route('users.edit', $user);
+ return Redirect::route('users.edit', $user)->with('success', 'User restored.');
}
}
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index fa78e87..85ca0a3 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -29,6 +29,11 @@ class AppServiceProvider extends ServiceProvider
return md5_file(public_path('mix-manifest.json'));
});
Inertia::share('app.name', Config::get('app.name'));
+ Inertia::share('flash', function () {
+ return [
+ 'success' => Session::get('success'),
+ ];
+ });
Inertia::share('errors', function () {
return Session::get('errors') ? Session::get('errors')->getBag('default')->getMessages() : (object) [];
});
diff --git a/resources/js/Shared/FlashMessages.vue b/resources/js/Shared/FlashMessages.vue
new file mode 100644
index 0000000..6bc99c5
--- /dev/null
+++ b/resources/js/Shared/FlashMessages.vue
@@ -0,0 +1,43 @@
+
+