nevakil
1 week ago

I can't get this to work

Posted 1 week ago by nevakil

Disclaimer: I don't understand eloquent enough. Please help

This does not work, please help!

$car = Car::all();
$customer = $car->brand;
return response()->json($brand->toArray(), 200);

This does work for me but I need more data

$car = Car::findOrFail($id);
$customer = $car->brand;

return response()->json($brand->toArray(), 200);

Can some one explain this to me?

Please sign in or create an account to participate in this conversation.