webdevask.com

Menu

  • Home
  • New
  • Add question

php - select data which has on json data in Laravel

View Original

one text

I have this JSON data on user table feild name 'pincodes': "["712401","712415"]" enter image description here

and I have an order table: which contains 'pincodes' field on database.

I want data from order table whose pincode has on "["712401","712415"]"

public function orders()
 {
     $pincodes = Auth::user()->pin_codes;
        
     $order_list = Order::whereJsonContains('pin_code',$pincodes)->get();
     //dd($order_list);
     return view('delivery.orders', compact('order_list'));
 }

Source

See also:

  • php สร้าง Google ชีตจากบัญชีบริการ

  • php - Laravel 8.0 Installation Failed

  • javascript - How to include HTML data (tags) as value in "arrayToDataTable" of Google Pie Chart?

  • how to Grouping array in php

  • php - vender folder from my laravel project has more 1k error

© 2021
E-mail: contact@webdevask.com
Back to top