Laravel Eloquent ORM - 获取第一和第三表数据

时间:2017-12-21 03:02:21

标签: laravel orm model eloquent

类别表

enter image description here

服务表

enter image description here

分支表

enter image description here

enter image description here

我有3个表链接在一起。上面是我的代码,我想生成与下面相同的结果。我可以使用一行代码来做到这一点吗?

或者我必须首先从2个表中获得结果,然后才获得Branch表?

感谢。

enter image description here

1 个答案:

答案 0 :(得分:1)

如果您想获得包含服务和分支的类别集合,您可以在一个雄辩的查询中急切地加载它们。

     var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
        ConvertSettings convertSettings = new ConvertSettings
        {
            CustomOutputArgs = "-filter_complex \"[0:v]setpts = 0.25 * PTS[v];[0:a] atempo=2.0[a],atempo=2.0[a] \" -map \"[v]\" -map \"[a]\""

        };

        string inputpath = tempvideolocation + "/tempvideo.mp4";
        string outputpath = tempvideolocation + "/convertedvideo.mp4";

        ffMpeg.ConvertMedia(inputpath, Format.mp4, outputpath, Format.mp4, convertSettings);

但是如果你想达到你的要求,你还需要多写一点。

Fractal Transformers可能会帮助你做到这一点。请参阅他们的文档here