如何查詢B表中比如有個content字段,模糊likeB中的某個值如文章表AArticleidtitlecontentuser_id用戶表BUseridname模型publicfunctionuser(){return$this->belongsTo(User::class);}偽代碼Article::with(['user'])//想通過文章作者的名字模糊查詢比如姓李的所有的文章//偽代碼//->where('user.name','like','%'.$name.'%');->orderBy('created_at','desc')->paginate(15);請問怎么實(shí)現(xiàn)呢?還想通過作者的的創(chuàng)建時間進(jìn)行排序?
請各位大佬指點(diǎn)!laravel ---- 關(guān)聯(lián)表 A 和 B 如何模糊查詢 B 表中指定的字段求老司機(jī)指點(diǎn)!
紅糖糍粑
2019-10-16 16:29:52