function phone($id) { return view('phone')->with(['phone' => Phone::findOrFail($id)]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $phone = \App\Models\Phone::findOrFail($id); $phone->delete(); return redirect(route('phone.index')); }
public function countByPhone($phone) { /** @var Phone $phone */ $phone = Phone::findOrFail($phone); return response()->json(['count' => $phone->offers()->count()], 200, [], JSON_UNESCAPED_UNICODE); }