Как отфильтровать коллекцию ларавеллы по данным - PullRequest
0 голосов
/ 10 мая 2018

У меня есть сбор данных

{"success": true, "doctor": [{"id": 1, "name": "Dr. Mayank", "dob": "1975-01-01 "," about ":" Это описание "," status ": 1," rating ": 2," rating_given_by ": 1," alternative_number ":" 7686876876 "," profile_photo ": []," speciality "": [{" id ": 3," name ":" Acupuncture "," image ": null," dashboard_flag ": 1}, {" id ": 4," name ":" Acupuncturist "," image ":null, "dashboard_flag": 1}, {"id": 1, "name": "Аварийная и неотложная медицинская помощь", "image": "http://192.168.16.21/remidify/media/174/detail.png"," dashboard_flag ": 1}]," service ":[{"id": 78, "name": "Исправление липкой улыбки", "cost": "12.00"}, {"id": 77, "name": "Dental эстетика", "cost": "43.00"}]," clinics ": [{" id ": 1," name ":" akram "," entity_id ": 1," entity_type ":" App \ Doctor "," contact_number ":" 2132132132132 "," status "": 0," consultancy_fee ":" 12.00 "," available_today ":" No "," owner_name ":" Dr.Mayank "," pivot ": {" doctor_id ": 1," clinic_id ": 1}," address ": {" id ": 1," address_1 ":" asdasdasdsa "," address_2 ":" "," locality ": "downtown", "city": "noida", "state": "up", "postal_code": "41561566"}, "speciality": [], "service": [{"id": 11, "name ":" Laminates "," cost ":" 20.00 "}, {" id ": 12," name ":" Dental Surgery "," Cost ":" 300.00 "}]," clinic_image ": [{" id": 7," model_id ": 1," model_type ":" App \ Clinic "," collection_name ":" clinic_image "," file_name ":" 1494863957588.566162.jpg "," disk ":" media "," url ":"http://192.168.16.21/remidify/media/7/1494863957588.566162.jpg"}]," id_image ": [{" id ": 8," model_id ": 1," model_type ":" App \ Clinic "," collection_name ":" id_image "," file_name ":"1494863966218.348877.jpg", "disk": "media", "url": "http://192.168.16.21/remidify/media/8/1494863966218.348877.jpg"}]," location ": {" id ": 1," latitude ": 0," longitude ": 0, "entity_id": 1, "entity_type": "App \ Clinic","creation_at": "2017-05-16 03:00:10", "updated_at": "2017-05-16 03:00:10" }, "clinic_timings": [ { "день": "солнце", "opens_at": "09:28:00", "closes_at": "21:28:00" } ] } ], "образование": [ { "id": 19, "Степень": "MBBS", "университет": "Университет", "год": "2017", "entity_id": 1, "entity_type": "App \ Doctor", "creat_at": "2017-05-16 05:44:11", "updated_at": "2017-05-16 05:44:11", "location": "Delhi" } ], "опыт": [ { "id": 19, «Больница»: «Название больницы», "post": "pta ni hai", "от": "1970-01-01", "to": "0000-00-00", "entity_id": 1, "entity_type": "App \ Doctor", "creat_at": "2017-05-16 05:44:12", "updated_at": "2017-05-16 05:44:12", "location": "Locations12", "is_currently_working": 1 } ], "постановка на учет": { "id": 1, "registration_number": "Рег. № 2324324", "registration_year": 1975, "registration_council": "Совет", «опыт»: ноль, "doctor_id": 1, "creat_at": "2017-05-16 02:56:37", "updated_at": "2017-05-16 02:56:37", "adhaar_number": "232131231232", "id_proof": [ { "id": 2, "model_id": 1, "model_type": "App \ DoctorRegistration", "collection_name": "id_proof", "имя_файла": "1494863680447.329102.jpg", "диск": "медиа", "url": "http://192.168.16.21/remidify/media/2/1494863680447.329102.jpg" } ], "Registration_proof": [ { "id": 3, "model_id": 1, "model_type": "App \ DoctorRegistration", "collection_name": "registration_proof", "имя_файла": "1494863687436.266846.jpg", "диск": "медиа", "url": "http://192.168.16.21/remidify/media/3/1494863687436.266846.jpg" } ], "qualification_proof": [ { "id": 4, "model_id": 1, "model_type": "App \ DoctorRegistration", "collection_name": "qualification_proof", "имя_файла": "1494863695576.803955.jpg", "диск": "медиа", "url": "http://192.168.16.21/remidify/media/4/1494863695576.803955.jpg" } ] }, "предпочтение": { «доступность»: 1, "назначение_ подтверждения": "руководство", «среднее время»: 7, "holiday_from": ноль, "holiday_till": ноль, "Patient_per_hour": ноль, «предпочитаемое_приложение»: «временной интервал», "назначение_частоты": ноль, "предпочитаемый_плата_метод": [ { "payment_method": "cash" }, { "payment_method": "онлайн" } ] }, "пользователь": ноль, "doctor_clinic": [ {"doctor_id": 1, "clinic_id": 1, "consultancy_fee": "12.00", "selected_at": ноль, "рабочие дни": [ { "день": "солнце", «доступно»: 1, "Рабочие часы": [ { "от": "09:28:00", "to": "21:28:00" } ] } ], "оказание услуг": [] } ] } ] }

Теперь, как мне найти врачей, чье "имя или специальность" соответствует какой-либо заданной строке поиска.

Заранее спасибо.

1 Ответ

0 голосов
/ 10 мая 2018

Попробуйте использовать помощник dd () и используйте как показано ниже

$youcollectionvariables = { "success": true, "doctor": [ { "id": 1, "name": "Dr. Mayank", "dob": "1975-01-01"................. }

dd($youcollectionvariables) 

вы увидите отформатированные данные и сможете найти то, что вам нужно.

Надеюсь, это поможет.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...