April 1, 2020
Adding User Role | Change Permissions by Admin | Ecommerce Website in Laravel tutorial for beginners

Adding User Role | Change Permissions by Admin | Ecommerce Website in Laravel tutorial for beginners

today we will cover a new topic like and use can see we have a admin column in our database table users and which user have admin equal to one that means that user is a admin ok that situation we will update by admin panel first of all let me call users okay and my sidebar menu I will create first of all is user interface then I will update that by our controller functions okay now it’s a lie so let’s say Li a anchor tag anchor tag will be let’s say your URL URL slash at me and users simply, we will call it by vue.js okay and see if you this we want to change its role like you can make any user admin okay now set the route left or PHP in the middleware of admin cultures new else is back route users and admin controller as users of cache now guys go to your app HTTP and your admin controller now make a new function okay your function name is users users and user’s data let’s say usersData(variable name) a data table name users paint and get function let’s get all hmm, call your view now admin.users(blade file) compact data you can use with also but this time is users data this guy it’s nice now makes this name of blade in your view resources view here admin folder make it just simply new file call it uses short flick forget be ok copy any of your styling copy this apply here and section and sure gives you can copy this section yes you can copy table also and your table jewelry with big table also so I am just hoping from product driftblade and it’s table closest if and both of this sections if close to sections section now I think I am okay yes you fresh yeah it’s okay leave the extra bars no check which column we have is his name email I soul will not displaying password but we will display addresses behalf of user ID that will be great okay name X users game female role but will be able let’s say role must videos select drop-down menu a so for collection name he and sorry here’s your email will be replacing dynamic data box I am just figure out content user interface and here name is / role and role you may say is user or admit okay and plus control go this butcher and select option while you admin now you can see one one for admin option second value zero you can use the null also and here’s user option yes I delete the extra bucks okay see trash and close that we D close the app we have already closed TF yes okay now refresh your user interface as you can see it’s now go to admin join this with a press table here at the refs table has a user ID okay user ID equal to Q 0 is s dot ID I think I am okay refresh you have no errors now try to displays user address you can say city country state here but wait a minute we have multiple rows for particular data cache will be which problem but try to make it here is your TF r f 4h and you just data and user duck and and your for each display a name user data nobody uses user data name oh please for email quick to front and your admission er you can see ya is multiple duck because we are using this joint okay if I use it first I think it’s not works okay for now remove this joint we will figure out slip first of all we have a disk users now we want to display and update this value okay here if this data let’s say use the data admin to one and you can say selected yeah select it and share and if something wrong I think about wait a minute refresh pop it is for second man copy and here we will use zero now it’s not works great at ethnic equal to zero at min equal to one let me try to display base user data admin fix name this works and I forget to paint this email ID okay as in fine let me use my PHP tags use user ID equal to this then I will use this one and s is not selected just copy this line okay use it as a second one this time we will use zero here here oh we just want to check with the admin who is not admins let me see what is wrong is that use the table this is a table admin ok it’s not zero there it is empty I think that’s why it’s not what’s working yeah you can see user user admin if I now back to your blade it here notice user so make it empty yes you can see that oh one more thing user data empty o0 admin here of the yes you can see it HTTP user is admin is should you Adam okay now make your Ajax code which type of the query which ID role okay here start your script and script goes we will call it by ID and fetch that particular ID value for that deaf start documents Kumud put ready okay yes start your function and we have a ID let’s say roll roll value will be coming from that people’re roll ID okay dot like this okay now try to Alex but goal but when it’s works I need to change the function according to that situation okay roll dots change function cut this refresh if I try to make it admin I think I have any error okay hmm it’s not making because I think I have some jQuery not included that point go to my masters wait a minute yeah so is this is smoked Hickory and put it for that let’s say go to your front where I’m using this type of mustache and here we have a cake ready just copy this fingers enough go to advanced master we have not here jQuery s why I think if ash okay yes snow solve your problem close extra fit this you go to just user code blade now we have a data for this particular but if I try to change this one it’s not working because we have a multiple thank you as you know we have to start it for loop for this let’s say start from one and maximum you can say 15 15 for now we will fix and plus plus okay here just edge ID in the IP according to your loop value okay and copy this okay now we need here also let’s say got control our from one a note here outside the load okay and inside the loop let’s say plus plus make it implement and in the ID just make it your ID call it okay just call it okay I think I forget to thank you everything okay refresh if I care to second something is problem is all we can check on that source role you can see roll one two three four five six that’s four fourteen because I will office and hey here is not working fine this is spacing spacing for that Y space I think for that refresh control you and here is not responding right for God is not notice this one okay now I think his will rework refresh try to randomly change the rule role is one and make it again user is zero okay right now go to your zoo here just start EDX and pass your value to second page for Dex just remove the this one Alex IX I’m sorry like people is not working fine and stage X type let’s say get and gotta yeah a double which user ID and your role ID role that you okay here um user ID user ID will be let’s see who’s already okay and start new with ant here is role value equal to this whole value and URL URL will be something like as you are not like that you are also like your default URL and admin middleware / update role yes fine that’s easier yes you’re here comma and this whole success is the success function will say console message this one’s this one’s all you can use console the flow pass successfully that’s nice okay now we need here posture I value from follow it’s nice we need here user ID user ID will be from our input we will make now si in the low input type x value users cut user data excuse you the ready that’s nice and I will be gooder I lik with count so throw okay now see the refresh you can see this you can make it hidden ice now point your cancer change it refresh one catch we have a adder we have a Adeline that catch it’s not like that this like refresh we don’t have any error just change it to admin now you can see oh spelling mistake there is : I think I’m not sending it right hmm dices little mistake here and here user ID you need to like this okay refresh make it admin now you have it data and wait a minute so you can see you have a data user ID one value one now randomly change it clear console is make it admin you can see user ID one make it one change again switch to user you read one is as showing error because I don’t have this route go to your web door PHP here route get and Edwin controller added 8 this make it new function in the admin same memo function public function we need request ok we need request quest will display your all data but I will display request i D I’m not getting any ID and getting user ID if flash changes randomly save successfully go to network I think you will see good value not point here okay okay now we have this and user IP and so so value request load vessel vessel and now update role t be able name evil name is users and here their ID culture issue that ID is also and update update will be six at a and when those clothes value step so if say update all it’s okay roll is operated successfully that’s all and don’t forget to update this console value with response going from I mean coming from that particular controller ok refresh now go to any randomly user and try to see here value will be change if everything is ok admin ok now I can see it’s nothing cause I think my query is wrong let me see it with this refresh user is 0 it’s ok just user ID let me show you a user ID the Zerg is not coming I think Paul is here this user ID variable name is wrong ok just remove this eco I’d like to catch your actual data after update ok make it user role a sex update successfully now check this now user is waked now make it again admin ok I think my connection is because I change my value from that I can’t open it without making make me fun it is redirecting to my home this not gay I think it’s no problem if I go to home admin I will not change my value because it’s too dangerous for me I will change the other value make it admin role is updated now make it again to this role is again update nothing is changes make it 2-0 okay now role is update successfully now we will display this data with our div for that we will make it this message success message with a I value okay and HTML response that’s all but we need to make it hidden by default okay make it hike because we don’t need this and after this make it ID success message okay success message with contrast this conk roll okay and just close that is because message will come from here controller okay if it is okay just make it more movable a lock success okay go to your Edwin refresh try to change any randomly user to make it admin it’s not role is update but is not showing my data that one wait a minute we can check with this let’s say success message yeah we have success messy one two three height here is response let me check here is your messages what I think we have not messages here I be one two three okay ah it’s little funny I forget to make it show again because I don’t want to eat it every time just refresh you will see a message success message make any user admin now role is operate successfully okay now refresh you will see is already admin okay make any other admin role is updates successfully make it again refresh now you can see make it again here is the rep now only I am only admit not at this one also zoli’s update successfully now in there you will see only one value I have okay make it admin you can see first well you have already admin ok I see you in the next video we will cover many topics in this series like a operate order same dysfunctionality and we will give functionality to user upload their profile pic and we will change user information by admin ok so in the next video thank you guys

5 thoughts on “Adding User Role | Change Permissions by Admin | Ecommerce Website in Laravel tutorial for beginners

  1. dude i think now you should start tutorial on android app . converting same ecommerce app created in laravel into android app..

  2. good tutorial, but can you help make the acl in laravel with Spatie Laravel Permission for control the post (like admin can create update delete and view and user can create and view only)

Leave a Reply

Your email address will not be published. Required fields are marked *