0

I am using the below eloquent:

  Book::selectRaw("name")
            ->where($bookWheres)
            ->with(['chapter'=>function ($query) use($chapterWheres)
            {
                $query->where($chapterWheres);
            }])
            ->get()->dd();

To set the $bookWheres / $chapterWheres I am pusing the array ['xx', '>=', '5']. However for the $chapterWhere I also need to push similar to ['timestamp', 'is', 'null'] since it is going to check if a timestamp column is null/empty.

->whereNull('timestamp') would usually work. However the where clause ['timestamp', 'is', 'null'] is a filter so it could just as well be not null, >= or <=.

Is it possbile to push "is null" into the array?

Laravel 7.

Line in Linus
  • 390
  • 8
  • 25

1 Answers1

0

Check it out> try this it would be work for you

Book::selectRaw("name")
        ->where([$bookWheres])
        ->with(['chapter'=>function ($query) use($chapterWheres)
        {
            $query->where([$chapterWheres]);
        }])
        ->get();
Md Rana Hossain
  • 304
  • 2
  • 7