#4 Edit Product | Laravel Updates | E-commerce website development tutorial


okay friends just continue laraShop 5.5
we are inside the admin panel today we will try to add it product by clicking
on this link if I click on this link is redirect to edit product blade and we
are passing and displaying simply ID so go to the your editor open route web dot
PHP here we are passing that route to treat IB we will say a bit product and
we will change which to view to get a pit bull buck blade with IB will be same
you will use here function and you can also read that to its controller of your
admin is up to you you can choose any method okay inside the function you will
pass the file okay here you will try to display your data with you right arm
view admin dot add beat product cheer break and second you need to dot data
same like done before but this time we will use
we’re conditioned app products model we’re Heidi this is the ideal and death
function ok civic now inside your admin folder added blade added product blade
we will try to display here just gotta which are we are passing data variable 0
is index of array and here just try to display any column name from icicle
table I am choosing product name save it go to the view as you can see its
product name let me try to one okay the me product now we have a already all
data okay now we will this all form bit button with Ajax and we will put here
okay go to the editor opens your add product copy this form actually it’s not
fun I mean it’s button text box is all thing inside you are content paste here this
one you will based here save it we need one more column because we are
editing so that’s why we need product ID also let me make it text after that we
will make it hidden Tranio your data variable index ID and we need ID of your
product ID the six and fill all columns like product name product code
everything like it we can copy this chain the name of column here also put
2004 product code and put that price why do you go and rest all so that price
save it okay now go to that add product paste copy your script for sure because
we are using same method here copy paste inside here edit product
plate save it and put here ID also which we are getting from adhere and okay in the JavaScript
variable ie this textbox ID is ideal so dot value save it okay now we will try
to pass this data just change it you actually do not to change it just a the
mess is outdated okay product has been updated everything
say okay now this will go to the say product route you can see here we
product it will go to admin controller go to the app HTTP controller admin
controller here you will see you have it insert command just copy this okay and
here ask if a be fun if you will say itself exact request ID
that means if ID is coming then update be proved that and
what you copy here but you need here ideal sorted so you can put here request
a role I and you don’t need to add grated while you are operating but you
need here we’re conditioned we’re ID that means product ID is equal to this
ID okay and else inside the else part you will put this month in such as now
insert the new product ok but we are sending the ID that means it will go to
the update people ok now I’ve showed your understand the logic just go to the
you refresh now you have a all data and go to the joy of my sitcom tables you
will see the changes here the wrong price let me that is 200 product has
been updated which product which product ID is 18 so 18 product this one refresh
ok is OK it’s insert that means we are going
through as far that is the actual logic okay we
have to see what we inside our is not party control if I click on comment
button go to the network okay IP is not defined that’s why is
inserting the new border inside and yet
that you will see why I t’s not IDs here display but here is not defined okay I put has save it eat the extra
entries now I’m sure we will get the right value we load the piece you don’t
need to a function so your eyes open I D is now passing I let me try to return the ID because the quest this way
you can debug your code very see and save it if – if I click
go to network say product and this boss you can see here is the 80 okay you are
getting here is the error advocate variable um that is actually okay you
are getting the ID what is going to as part that is not right if we said our
offense is not working and P you can try this one also okay okay I forget to
clean something I have to paint it properly – I’m sorry guys a silly
mistake save it go to the musical table browser delete extra entries that is my
mistake I am sorry save it you don’t need any console now you can
hide this text box also added product make it height then I freaking to return
a prett height okay now change your product price save it go to my sequel
change it now you can see is product prices change okay go to the all product
chain this let me change all data dummies for 3m III and price
will be 300 save it now product as in update let me refresh to confirm yes
your product is update now okay one more thing here is second do
okay here we will display product image go to jail for DITA delete this
paragraph and adhere go back go back
email that’s – you can choose anything and email source URL and public less email and you will
prepare yes got a variable with index and column name is product email and
built which may be under percent save it and closing if now you can see is
product image default image we are not by earning here emails while admin edit
it will go to where here they can change this image okay we will make new blade
to chain the default image this is the our product editing logic you can add
more column we will fix it everything in the next video thank us

3 Comments

Add a Comment

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