File tree Expand file tree Collapse file tree 6 files changed +63
-12
lines changed Expand file tree Collapse file tree 6 files changed +63
-12
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public function store()
64
64
])
65
65
);
66
66
67
- return Redirect::route ('contacts ' );
67
+ return Redirect::route ('contacts ' )-> with ( ' success ' , ' Contact created. ' ) ;
68
68
}
69
69
70
70
public function edit (Contact $ contact )
@@ -111,20 +111,20 @@ public function update(Contact $contact)
111
111
])
112
112
);
113
113
114
- return Redirect::route ('contacts.edit ' , $ contact );
114
+ return Redirect::route ('contacts.edit ' , $ contact )-> with ( ' success ' , ' Contact updated. ' ) ;
115
115
}
116
116
117
117
public function destroy (Contact $ contact )
118
118
{
119
119
$ contact ->delete ();
120
120
121
- return Redirect::route ('contacts.edit ' , $ contact );
121
+ return Redirect::route ('contacts.edit ' , $ contact )-> with ( ' success ' , ' Contact deleted. ' ) ;
122
122
}
123
123
124
124
public function restore (Contact $ contact )
125
125
{
126
126
$ contact ->restore ();
127
127
128
- return Redirect::route ('contacts.edit ' , $ contact );
128
+ return Redirect::route ('contacts.edit ' , $ contact )-> with ( ' success ' , ' Contact restored. ' ) ;
129
129
}
130
130
}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public function store()
42
42
])
43
43
);
44
44
45
- return Redirect::route ('organizations ' );
45
+ return Redirect::route ('organizations ' )-> with ( ' success ' , ' Organization created. ' ) ;
46
46
}
47
47
48
48
public function edit (Organization $ organization )
@@ -79,20 +79,20 @@ public function update(Organization $organization)
79
79
])
80
80
);
81
81
82
- return Redirect::route ('organizations.edit ' , $ organization );
82
+ return Redirect::route ('organizations.edit ' , $ organization )-> with ( ' success ' , ' Organization updated. ' ) ;
83
83
}
84
84
85
85
public function destroy (Organization $ organization )
86
86
{
87
87
$ organization ->delete ();
88
88
89
- return Redirect::route ('organizations.edit ' , $ organization );
89
+ return Redirect::route ('organizations.edit ' , $ organization )-> with ( ' success ' , ' Organization deleted. ' ) ;
90
90
}
91
91
92
92
public function restore (Organization $ organization )
93
93
{
94
94
$ organization ->restore ();
95
95
96
- return Redirect::route ('organizations.edit ' , $ organization );
96
+ return Redirect::route ('organizations.edit ' , $ organization )-> with ( ' success ' , ' Organization restored. ' ) ;
97
97
}
98
98
}
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public function store()
48
48
])
49
49
);
50
50
51
- return Redirect::route ('users ' );
51
+ return Redirect::route ('users ' )-> with ( ' success ' , ' User created. ' ) ;
52
52
}
53
53
54
54
public function edit (User $ user )
@@ -81,20 +81,20 @@ public function update(User $user)
81
81
$ user ->update (['password ' => Request::get ('password ' )]);
82
82
}
83
83
84
- return Redirect::route ('users.edit ' , $ user );
84
+ return Redirect::route ('users.edit ' , $ user )-> with ( ' success ' , ' User updated. ' ) ;
85
85
}
86
86
87
87
public function destroy (User $ user )
88
88
{
89
89
$ user ->delete ();
90
90
91
- return Redirect::route ('users.edit ' , $ user );
91
+ return Redirect::route ('users.edit ' , $ user )-> with ( ' success ' , ' User deleted. ' ) ;
92
92
}
93
93
94
94
public function restore (User $ user )
95
95
{
96
96
$ user ->restore ();
97
97
98
- return Redirect::route ('users.edit ' , $ user );
98
+ return Redirect::route ('users.edit ' , $ user )-> with ( ' success ' , ' User restored. ' ) ;
99
99
}
100
100
}
Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ public function register()
29
29
return md5_file (public_path ('mix-manifest.json ' ));
30
30
});
31
31
Inertia::share ('app.name ' , Config::get ('app.name ' ));
32
+ Inertia::share ('flash ' , function () {
33
+ return [
34
+ 'success ' => Session::get ('success ' ),
35
+ ];
36
+ });
32
37
Inertia::share ('errors ' , function () {
33
38
return Session::get ('errors ' ) ? Session::get ('errors ' )->getBag ('default ' )->getMessages () : (object ) [];
34
39
});
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <div v-if =" $page.flash.success && show" class =" mb-8 flex items-center justify-between bg-green rounded max-w-lg" >
4
+ <div class =" flex items-center" >
5
+ <svg class =" ml-4 mr-2 flex-no-shrink w-4 h-4 fill-white" xmlns =" http://www.w3.org/2000/svg" viewBox =" 0 0 20 20" ><polygon points =" 0 11 2 9 7 14 18 3 20 5 7 18" /></svg >
6
+ <div class =" py-4 text-white text-sm font-medium" >{{ $page.flash.success }}</div >
7
+ </div >
8
+ <button type =" button" class =" group mr-2 p-2" @click =" show = false" >
9
+ <svg class =" block w-2 h-2 fill-green-dark group-hover:fill-green-darker" xmlns =" http://www.w3.org/2000/svg" width =" 235.908" height =" 235.908" viewBox =" 278.046 126.846 235.908 235.908" ><path d =" M506.784 134.017c-9.56-9.56-25.06-9.56-34.62 0L396 210.18l-76.164-76.164c-9.56-9.56-25.06-9.56-34.62 0-9.56 9.56-9.56 25.06 0 34.62L361.38 244.8l-76.164 76.165c-9.56 9.56-9.56 25.06 0 34.62 9.56 9.56 25.06 9.56 34.62 0L396 279.42l76.164 76.165c9.56 9.56 25.06 9.56 34.62 0 9.56-9.56 9.56-25.06 0-34.62L430.62 244.8l76.164-76.163c9.56-9.56 9.56-25.06 0-34.62z" /></svg >
10
+ </button >
11
+ </div >
12
+ <div v-if =" Object.keys($page.errors).length > 0 && show" class =" mb-8 flex items-center justify-between bg-red-light rounded max-w-lg" >
13
+ <div class =" flex items-center" >
14
+ <svg class =" ml-4 mr-2 flex-no-shrink w-4 h-4 fill-white" xmlns =" http://www.w3.org/2000/svg" viewBox =" 0 0 20 20" ><path d =" M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm1.41-1.41A8 8 0 1 0 15.66 4.34 8 8 0 0 0 4.34 15.66zm9.9-8.49L11.41 10l2.83 2.83-1.41 1.41L10 11.41l-2.83 2.83-1.41-1.41L8.59 10 5.76 7.17l1.41-1.41L10 8.59l2.83-2.83 1.41 1.41z" /></svg >
15
+ <div class =" py-4 text-white text-sm font-medium" >
16
+ <span v-if =" Object.keys($page.errors).length === 1" >There is one form error.</span >
17
+ <span v-else >There are {{ Object.keys($page.errors).length }} form errors.</span >
18
+ </div >
19
+ </div >
20
+ <button type =" button" class =" group mr-2 p-2" @click =" show = false" >
21
+ <svg class =" block w-2 h-2 fill-red-dark group-hover:fill-red-darker" xmlns =" http://www.w3.org/2000/svg" width =" 235.908" height =" 235.908" viewBox =" 278.046 126.846 235.908 235.908" ><path d =" M506.784 134.017c-9.56-9.56-25.06-9.56-34.62 0L396 210.18l-76.164-76.164c-9.56-9.56-25.06-9.56-34.62 0-9.56 9.56-9.56 25.06 0 34.62L361.38 244.8l-76.164 76.165c-9.56 9.56-9.56 25.06 0 34.62 9.56 9.56 25.06 9.56 34.62 0L396 279.42l76.164 76.165c9.56 9.56 25.06 9.56 34.62 0 9.56-9.56 9.56-25.06 0-34.62L430.62 244.8l76.164-76.163c9.56-9.56 9.56-25.06 0-34.62z" /></svg >
22
+ </button >
23
+ </div >
24
+ </div >
25
+ </template >
26
+
27
+ <script >
28
+ export default {
29
+ data () {
30
+ return {
31
+ show: true ,
32
+ }
33
+ },
34
+ watch: {
35
+ ' $page.flash' : {
36
+ handler () {
37
+ this .show = true
38
+ },
39
+ deep: true ,
40
+ },
41
+ },
42
+ }
43
+ </script >
Original file line number Diff line number Diff line change 38
38
<main-menu />
39
39
</div >
40
40
<div class =" w-full overflow-hidden px-4 py-8 md:p-12" >
41
+ <flash-messages />
41
42
<slot />
42
43
</div >
43
44
</div >
48
49
49
50
<script >
50
51
import Dropdown from ' @/Shared/Dropdown'
52
+ import FlashMessages from ' @/Shared/FlashMessages'
51
53
import Icon from ' @/Shared/Icon'
52
54
import Logo from ' @/Shared/Logo'
53
55
import MainMenu from ' @/Shared/MainMenu'
54
56
55
57
export default {
56
58
components: {
57
59
Dropdown,
60
+ FlashMessages,
58
61
Icon,
59
62
Logo,
60
63
MainMenu,
You can’t perform that action at this time.
0 commit comments