10.11 Update
Wait, did I say heels in that last section? They were hot pink skate shoes! If only we could go
back and fix our mistake. I could update the table and no one would see my shame. Oh I guess
we could probably use the update() method, you see it takes an array with the same syntax as
insert().
1 <?php
2
3 DB::table('shoes')->update(array(
4 'type' => 'skate shoes'
5 ));
Hold on, we aren’t specifying a record here. I don’t want to change all my records to skate shoes,
it would ruin my wonderful Laravel flip flops. Let’s use a where() method and that $id we got
earlier to narrow it down to the record we want. Chain time!
1 <?php
2
3 DB::table('shoes')
4 ->where('id', '=', $id)
5 ->update(array(
6 'type' => 'skate shoes'
7 ));
There, we fixed the problem before anyone noticed.
Anil Bist
Skills Laravel
Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-
I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore