zaten resource ile show metodu geliyor. eğer model tanımlamadıysak controller’a
1 2 3 4 5 6 7 8 |
public function show($id) { $product = product::find($id); if($product) return response($product,200); else return response(['message' => 'Ürün bulunamadı'],404); } |
eğer modelimiz varsa
1 2 3 4 |
public function show(product $product) { return response($product,200); /* örnek kullanım */ } |