File tree Expand file tree Collapse file tree 6 files changed +33
-12
lines changed Expand file tree Collapse file tree 6 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,18 @@ public function store(ClientRequest $request)
51
51
{
52
52
$ data = $ request ->all ();
53
53
54
+ $ redirect = $ request ->input ('redirect ' );
54
55
55
- Client::create ($ data );
56
+ $ client = Client::create ($ data );
56
57
57
58
if (request ()->wantsJson ()) {
58
59
return response ([], 200 );
59
60
}
60
61
62
+ if ($ redirect ) {
63
+ return redirect (route ($ redirect )."?client_id= " .$ client ->id );
64
+ }
65
+
61
66
return redirect ('/clients ' );
62
67
}
63
68
Original file line number Diff line number Diff line change @@ -61,12 +61,18 @@ public function store(UserRequest $request)
61
61
62
62
$ data ['is_active ' ] = request ()->has ('is_active ' );
63
63
64
+ $ redirect = $ request ->input ('redirect ' );
65
+
64
66
$ user = User::create ($ data );
65
67
66
68
if (request ()->wantsJson ()) {
67
69
return response ([], 200 );
68
70
}
69
71
72
+ if ($ redirect ) {
73
+ return redirect (route ($ redirect )."?user_id= " .$ user ->id );
74
+ }
75
+
70
76
return redirect ('/users ' );
71
77
}
72
78
Original file line number Diff line number Diff line change 1
1
<div class =" d-flex flex-wrap" >
2
- <div class =" col-4 form-group" >
3
- {{ html ()-> label (' User Id' )
4
- -> for (' user_id' )
5
- -> class (' mb-0 form-label' )
6
- } }
2
+ <div class =" col-4 form-group" >
3
+ <div class =" d-flex justify-content-between" >
4
+ {{ html ()-> label (' User Id' )
5
+ -> for (' user_id' )
6
+ -> class (' mb-0 form-label' )
7
+ } }
8
+ <a href =" {{ route (' users.create' ). ' ?redirect=' . request ()-> route ()-> getName () } }" > ( + Add New )</a >
9
+ </div >
10
+
7
11
{{ html ()-> select (' user_id' )
8
12
-> options ($usersforname )
9
13
-> placeholder (' User Id' )
10
14
-> class ([' form-control custom-select' , ' is-invalid' => $errors -> has (' user_id' )])
15
+ -> value (request () ? request ()-> get (' user_id' ) : ' ' )
11
16
} }
12
17
13
18
@if ($errors -> has (' user_id' ) )
Original file line number Diff line number Diff line change 8
8
<div class =" col-lg-12 col-md-12" >
9
9
<div class =" card card-small mb-3" >
10
10
<div class =" card-body" >
11
- {{ html ()-> form (' POST' , route (' clients.store' ))
11
+ {{ html ()-> form (' POST' , route (' clients.store' ). ' ?redirect= ' . request () -> get ( ' redirect ' ) )
12
12
-> acceptsFiles ()
13
13
-> open () } }
14
14
Original file line number Diff line number Diff line change 17
17
@endif
18
18
</div >
19
19
<div class =" col-4 form-group" >
20
- {{ html ()-> label (' Client Id' )
21
- -> for (' client_id' )
22
- -> class (' mb-0 form-label' )
23
- } }
20
+ <div class =" d-flex justify-content-between" >
21
+ {{ html ()-> label (' Client Id' )
22
+ -> for (' client_id' )
23
+ -> class (' mb-0 form-label' )
24
+ } }
25
+ <a href =" {{ route (' clients.create' ). ' ?redirect=' . request ()-> route ()-> getName () } }" > ( + Add New )</a >
26
+ </div >
27
+
24
28
{{ html ()-> select (' client_id' )
25
29
-> options ($clientsforname )
26
30
-> placeholder (' Client Id' )
27
31
-> class ([' form-control custom-select' , ' is-invalid' => $errors -> has (' client_id' )])
32
+ -> value (request () ? request ()-> get (' client_id' ) : ' ' )
28
33
} }
29
34
30
35
@if ($errors -> has (' client_id' ) )
Original file line number Diff line number Diff line change 8
8
<div class =" col-lg-12 col-md-12" >
9
9
<div class =" card card-small mb-3" >
10
10
<div class =" card-body" >
11
- {{ html ()-> form (' POST' , route (' users.store' ))
11
+ {{ html ()-> form (' POST' , route (' users.store' ). ' ?redirect= ' . request () -> get ( ' redirect ' ) )
12
12
-> acceptsFiles ()
13
13
-> open () } }
14
14
You can’t perform that action at this time.
0 commit comments