Похожие чаты

I have the following tables payments --------- id, user_id, payable_id, payable_type, status Payable can

be of type User Subscriptions / Courses Registered and something else too



course_categories
---------------
id, name, slug

courses
-------
id, name, currency_id, price, course_category_id, language_id


I want to query all the payments made by login user and with status success which can be done with the following



$payments = Payment::where([
'user_id' => $user->id,
'status' => 'success'
])
->get();


But I need all the relationship records too like the following



$payments = Payment::with(['courses', 'courses.courseCategory])
->where([
'user_id' => $user->id,
'status' => 'success'
])
->get();
The following with Payable works but I need the relations of payable

$payments = Payment::with(['payble'])
->where([
'user_id' => $user->id,
'status' => 'success'
])
->get();


How can I achieve it? If I do as ['payable'] then it returns the respective records. But I need payables courses or course_category

1 ответов

14 просмотров
Flying-Dragon Автор вопроса

Got it working thank you pals

Похожие вопросы

Обсуждают сегодня

Hey everyone! I won’t focus too much on what this person said (it’s clear they don’t understand the scope of what TF and TELOSX are achieving), but I’ll put it simply for thos...
Ana Ojeda
3
what do you guy think about the current performance of $FTM compare to the rest of the market?
💀zeThrouzz🦞
12
Hi did any of you experience a file error when download hex file for Windows?
Valya
17
Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
как правильно удалить сддм? прописал в etc/portage.use/plasma-meta -sddm , но при обновлении юзов мне предлагает поставить lightdm (ещё лучше 😡), добавил туда - display-manage...
REDis
25
Всем привет! Имеется функция: function IsValidChar(ch: UTF8Char): Boolean; var i: Integer; ValidChars: AnsiString; begin ValidChars := 'abcdefghijklmnopqrstuvwxyzABCDE...
Евгений
44
Коллеги, я тут для личных нужд пошел ставить MQTT сервер, пощупал mosquitto, но ужаснулся отсутствию такой банальности, как HTTP API для посмотреть список топиков. А тут что,...
Maksim Lapshin
14
Please I want to ask if my stake is 24% complete, what penalty will I pay if I end the stake?
Crypto Advocate
12
Also, scrolling at the history here, I see there was alot of hate towards kaspa.. is it still the case after they proved the history of the chain?
Gad Levy | AnyLog
11
Could the new Norse labs apps have just been called "VPN" instead of DVPN?
HDGVII
14
Карта сайта