I have a table product that looks like this:
I am getting data from the product table but I need this data from LOW to HIGH by price. I have tried to get products price by ascending order but I am getting ascending order like 1,2,3,4 Now we have prices like 80,900,100,30 I need like this 30,80,100,900. I have tried this query but I am not getting an exact result.
$low_to_high = DB::table('products')
->where([
['products_categories_id', $id]
])->orderBy('price','ASC')->get();
Result Array:
Array
(
[0] => stdClass Object
(
[id] => 12
[user_id] => 5
[products_categories_id] => 22
[first_cat] => 1
[sec_cat] => 3
[price] => 110
[title] => ARTIST COLOR PENCIL
[image] => http://banatapp.com/Bannat_app/uploads/product/1543473823extremecleanser_44062_0.png
[description] => AQUA XL INK LINER is a waterproof liquid eyeliner which hugs lash lines with comfort and instant color intensity for 24-hour lasting.
This athleisure color collection features 11 intense liquid eyeliner shades from matte to lustrous, diamond and metallic, with a luminous finish. This waterproof yet very flexible, light liquid texture will hug all lash lines with comfort and instant color intensity for 24-hour lasting. The semi-flex applicator offers a lining range from high-precision to extra thick coloring. Featuring a color-coded tip and cap, the secure closing system guarantees airtightness and preserves the color’s intensity.
[sale] =>
[qty] => 25
[options] => http://banatapp.com/Bannat_app/uploads/product/1543473823Color_Airbrush_M100.png|http://banatapp.com/Bannat_app/uploads/product/1543473823Color_Ink_M100.png|http://banatapp.com/Bannat_app/uploads/product/1543473823Color_Stick_M100.png|http://banatapp.com/Bannat_app/uploads/product/1543473823extremecleanser_44062_0.png|http://banatapp.com/Bannat_app/uploads/product/1543473823EYELINER.png
[created_at] => 2018-11-29 06:43:43
[updated_at] => 2018-11-29 06:43:43
)
[1] => stdClass Object
(
[id] => 13
[user_id] => 5
[products_categories_id] => 22
[first_cat] => 1
[sec_cat] => 3
[price] => 20
[title] => ARTIST STICK PENCIL
[image] => http://banatapp.com/Bannat_app/uploads/product/1543476576Color_Stick_M100.png
[description] => This isn't going to be some rah-rah, pumped-up motivational speech. (That's not my style.) Instead, we're going to break down the science behind how to get motivated in the first place and how to stay motivated for the long-run. Whether you're trying to figure out how to motivate yourself or how to motivate a team, this page should cover everything you need to know.
You can click the links below to jump to a particular section or simply scroll down to read everything. At the end of this page, you'll find a complete list of all the articles I have written on motivation.
[sale] =>
[qty] => 30
[options] => http://banatapp.com/Bannat_app/uploads/product/1543476576AQUABROW.png|http://banatapp.com/Bannat_app/uploads/product/1543476576artist_rouge.png|http://banatapp.com/Bannat_app/uploads/product/1543476576brush_cleanser_50003_0.png|http://banatapp.com/Bannat_app/uploads/product/1543476576SCULPTINGBROW.png
[created_at] => 2018-11-29 07:29:36
[updated_at] => 2018-11-29 07:29:36
)
[2] => stdClass Object
(
[id] => 14
[user_id] => 5
[products_categories_id] => 22
[first_cat] => 1
[sec_cat] => 3
[price] => 200
[title] => EYELINER ARTIST COLOR
[image] => http://banatapp.com/Bannat_app/uploads/product/1543476656EYELINER.png
[description] => This isn't going to be some rah-rah, pumped-up motivational speech. (That's not my style.) Instead, we're going to break down the science behind how to get motivated in the first place and how to stay motivated for the long-run. Whether you're trying to figure out how to motivate yourself or how to motivate a team, this page should cover everything you need to know.
You can click the links below to jump to a particular section or simply scroll down to read everything. At the end of this page, you'll find a complete list of all the articles I have written on motivation.
[sale] =>
[qty] => 25
[options] => http://banatapp.com/Bannat_app/uploads/product/1543476656SCULPTINGBROW.png|http://banatapp.com/Bannat_app/uploads/product/1543476656senseyes_44151_0.png|http://banatapp.com/Bannat_app/uploads/product/1543476656smoky_lash_23301_0.png|http://banatapp.com/Bannat_app/uploads/product/1543476656WATERBLEND.png
[created_at] => 2018-11-29 07:30:56
[updated_at] => 2018-11-29 07:30:56
)
[3] => stdClass Object
(
[id] => 15
[user_id] => 5
[products_categories_id] => 22
[first_cat] => 1
[sec_cat] => 3
[price] => 100
[title] => BRUSH CLEANSER BRUSH CLEANSER
[image] => http://banatapp.com/Bannat_app/uploads/product/1543476725brush_cleanser_50003_0.png
[description] => This isn't going to be some rah-rah, pumped-up motivational speech. (That's not my style.) Instead, we're going to break down the science behind how to get motivated in the first place and how to stay motivated for the long-run. Whether you're trying to figure out how to motivate yourself or how to motivate a team, this page should cover everything you need to know.
You can click the links below to jump to a particular section or simply scroll down to read everything. At the end of this page, you'll find a complete list of all the articles I have written on motivation.
[sale] =>
[qty] => 30
[options] => http://banatapp.com/Bannat_app/uploads/product/1543476725POUCH.png|http://banatapp.com/Bannat_app/uploads/product/1543476725SCULPTINGBROW.png|http://banatapp.com/Bannat_app/uploads/product/1543476725senseyes_44151_0.png|http://banatapp.com/Bannat_app/uploads/product/1543476725WATERBLEND.png
[created_at] => 2018-11-29 07:32:05
[updated_at] => 2018-11-29 07:32:05
)
[4] => stdClass Object
(
[id] => 16
[user_id] => 5
[products_categories_id] => 22
[first_cat] => 1
[sec_cat] => 3
[price] => 80
[title] => WATER BLIND STICK COLOUR
[image] => http://banatapp.com/Bannat_app/uploads/product/1543476879WATERBLEND.png
[description] => This isn't going to be some rah-rah, pumped-up motivational speech. (That's not my style.) Instead, we're going to break down the science behind how to get motivated in the first place and how to stay motivated for the long-run. Whether you're trying to figure out how to motivate yourself or how to motivate a team, this page should cover everything you need to know.
You can click the links below to jump to a particular section or simply scroll down to read everything. At the end of this page, you'll find a complete list of all the articles I have written on motivation.
[sale] =>
[qty] => 90
[options] => http://banatapp.com/Bannat_app/uploads/product/1543476879artist_rouge.png|http://banatapp.com/Bannat_app/uploads/product/1543476879LIPBRUSH.png|http://banatapp.com/Bannat_app/uploads/product/1543476879MASCARA.png|http://banatapp.com/Bannat_app/uploads/product/1543476879smoky_lash_23301_0.png
[created_at] => 2018-11-29 07:34:39
[updated_at] => 2018-11-29 07:34:39
)
[5] => stdClass Object
(
[id] => 17
[user_id] => 5
[products_categories_id] => 22
[first_cat] => 1
[sec_cat] => 3
[price] => 110
[title] => ARTIST ROUGE COLOR PENCIL
[image] => http://banatapp.com/Bannat_app/uploads/product/1543476939artist_rouge.png
[description] => This isn't going to be some rah-rah, pumped-up motivational speech. (That's not my style.) Instead, we're going to break down the science behind how to get motivated in the first place and how to stay motivated for the long-run. Whether you're trying to figure out how to motivate yourself or how to motivate a team, this page should cover everything you need to know.
You can click the links below to jump to a particular section or simply scroll down to read everything. At the end of this page, you'll find a complete list of all the articles I have written on motivation.
[sale] =>
[qty] => 25
[options] => http://banatapp.com/Bannat_app/uploads/product/1543476939AQUABROW.png|http://banatapp.com/Bannat_app/uploads/product/1543476939artist_rouge.png|http://banatapp.com/Bannat_app/uploads/product/1543476939Color_Airbrush_M100.png|http://banatapp.com/Bannat_app/uploads/product/1543476939Color_Ink_M100.png|http://banatapp.com/Bannat_app/uploads/product/1543476939Color_Stick_M100.png
[created_at] => 2018-11-29 07:35:39
[updated_at] => 2018-11-29 07:35:39
)
)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire