File tree 2 files changed +56
-7
lines changed
2 files changed +56
-7
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ public function edit(Role $role)
60
60
*/
61
61
public function update (Request $ request , string $ id )
62
62
{
63
- //
63
+ Role::where ('id ' , $ id )->update ($ request ->all ());
64
+
65
+ return redirect ('/roles ' )->with ('success ' , 'Role has been updated! ' );
64
66
}
65
67
66
68
/**
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div >
3
- <AppLayout title =" Edit role" >
4
- Edit role: {{ role.name }}
5
- </AppLayout >
6
- </div >
2
+ <AppLayout title =" Edit role" >
3
+
4
+ <template #header >
5
+ <Breadcrumb :href =" 'roles'" :title =" 'Roles'" :property =" role" />
6
+ </template >
7
+
8
+ <div class =" py-12" >
9
+ <div class =" mx-auto max-w-7xl sm:px-6 lg:px-8" >
10
+ <div class =" w-full max-w-xs m-auto" >
11
+ <form @submit.prevent =" submit" class =" px-8 pt-6 pb-8 mb-4 bg-white rounded shadow-md" >
12
+
13
+ <div class =" mb-4" >
14
+ <label class =" block mb-2 text-sm font-bold text-gray-700" for =" name" >
15
+ Role name
16
+ </label >
17
+ <input v-model =" form.name"
18
+ class =" w-full px-3 py-2 leading-tight text-gray-700 border rounded shadow appearance-none focus:outline-none focus:shadow-outline"
19
+ id =" name" type =" text" >
20
+ </div >
21
+
22
+ <div class =" flex items-center justify-between" >
23
+ <Button :form =" form" ></Button >
24
+ </div >
25
+ </form >
26
+ <p class =" text-xs text-center text-gray-500" >
27
+ © ; 2023 - <a class =" text-blue-500" href =" https://github.com/perisicnikola37"
28
+ target =" _blank" >@perisicnikola37</a >
29
+ </p >
30
+ </div >
31
+
32
+ </div >
33
+ </div >
34
+ </AppLayout >
7
35
</template >
8
36
9
37
<script >
38
+ import Breadcrumb from " @/Components/Breadcrumb.vue" ;
39
+ import Button from " @/Components/Button.vue" ;
10
40
import AppLayout from ' @/Layouts/AppLayout.vue' ;
11
41
12
42
export default {
43
+ components: {
44
+ AppLayout,
45
+ Breadcrumb,
46
+ Button
47
+ },
13
48
props: {
14
49
role: Object ,
15
50
},
16
- components: { AppLayout }
51
+ data () {
52
+ return {
53
+ form: this .$inertia .form ({
54
+ name: this .role .name ,
55
+ })
56
+ }
57
+ },
58
+ methods: {
59
+ submit () {
60
+ this .form .put (this .route (' roles.update' , this .role .id ), {
61
+ })
62
+ }
63
+ }
17
64
}
18
65
</script >
You can’t perform that action at this time.
0 commit comments