嵌套模型的laravel模型关系

时间:2019-08-24 14:04:56

标签: php laravel

我在laravel项目中有三个表,分别是: -中央 -付款 -payment_details

中心表: enter image description here

付款表: enter image description here

payment_details表: enter image description here

现在我想从payment_details表中选择所有数据,我很好地显示了它,但是列表中有一个用于payment_type的搜索选项,但是搜索字段不在payment-details表中,所以我没有知道如何从另一个表中检索该信息

1 个答案:

答案 0 :(得分:0)

如果您要使用雄辩的关系建模数据,请执行以下操作:

str1 = ['hello', 'there', 'graham', 'pushkin', 'fizzybubblech', 'ciao', 'meestersonuvabeech', 'russia'] # wrote this just to amuse myself

str1.sort(key = len) # within the parenthesis is where the warning is issued 

print(str1)

> #This is the warning i recieve. First questionn in overflow, so i just pasted the whole thing 
>Expected type 'Optional[(str) -> Any]' (matched
> generic type 'Optional[(_T) -> Any]'), got '(o: Sized) -> int' instead
> less... (Ctrl+F1)  Inspection info: This inspection detects type
> errors in function call expressions. Due to dynamic dispatch and duck
> typing, this is possible in a limited but useful number of cases.
> Types of function parameters can be specified in docstrings or in
> Python 3 function annotations.

如果不是,则必须使用付款表进行加入声明