doudi2833 2018-06-22 09:47
浏览 10

除了那些有音频或视频Laravel Eloquent之外的所有问题

Hi there can someone please help me is it possible to take only the questions that dont have audio or video included to ignore those questions that have audio or video :

This is my controller a part of my controller:

 public function generateTestPdf(Request $request){

        $test_id   = $request['test_id'];

        $test               = Test::where('id', $test_id)->first();
        $test_info          = (new TestInfoController)->testInfo($test_id);

        $test_questions     = (new TestQuestionsController)->questionwithanswers($test_id, $randomorder = 1);

.
.
.
and so on..

From this $test_questions this is my result when I die dump I have two questions one with audio included and the other no audio, I want to be able the question with audio to ignore, to not take that . How can I put a message and say audio and video not included and to not include them? enter image description here

enter image description here

  • 写回答

1条回答 默认 最新

  • doukesou4452 2018-06-22 10:00
    关注

    Modify your questionwithanswers method and add the following to the query builder:

    ->whereNull('question_audio')
    ->whereNull('question_video')
    

    https://laravel.com/docs/5.6/queries#where-clauses

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度