First use " Illuminate\Support\Facades\DB " Then write DB::select('select * from hotel_reception where !(status != 0 and tag = "reserve")' );
No, I do not want that
Please refer to Laravel codes
I do not want the output to be array
If you want to group the where statements you can use a closure.
Not tested example:
Reception::whereNot(static function ($query) {
$query->whereNot('status', 0)
->where('tag', 'reserve');
})->get();
jetwes liked this reply
you can do in many ways suppose you can write with DB::select('write raw sql'), with DB::raw ('write raw sql'), and also you can write eloquent model
Solution is
$receptions = Reception::where([
'hotel_id' => $hotel_id,
'payed'=> 1
])->whereNot('staying_time', 0)->get();
You can also use 'Dazzler' and 'Tobias van Beek' Solution. both is also right
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community