I have in my database many ads , I want to select one from theme by name I try but I get a null return
public function index()
{
# code...
// $Ads = ads::all();
// return $this->sendResponse($Ads->toArray(), 'Ads read succesfully');
$column = 'name'; // This is the name of the column you wish to search
$Ads = ads::where($column , = , $id)->first();
return response()->json(['success'=> true,'ads'=>$Ads, 'message'=> 'Ads read succesfully']);
}
and this what I get in post man:
{ "success": true, "ads": null, "message": "Ads read succesfully" }
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire