Untitled

 avatar
unknown
plain_text
2 months ago
346 B
11
Indexable
$products = Product::with('category')->when($request->status, function($query)use($request){
            $query->where('status', 'like',"%{$request->status}%");
            
        })->orderBy('favorite', 'desc')->get();
        return response()->json([
            'status' => 'success',
            'data' => $products
        ], 200);
Editor is loading...
Leave a Comment