public function destroy($id) { $renter = Renter::findOrFail($id); $contract = Contract::where('renter_id', '=', $id)->delete(); $renter->delete(); return redirect('renters'); }
public function create() { $rented = Contract::select('property_id')->get(); $renters = Renter::select('id', 'first_name', 'last_name')->get()->toArray(); $properties = Property::select('id', 'address')->whereNotIn('id', $rented)->get()->toArray(); return view('contracts.create', compact('rented', 'renters', 'properties')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $renter = Renter::findOrFail($id); $renter->delete(); return redirect('renter'); }