public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Landlord::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // // return Landlord::with('properties')->get(); return Landlord::with('properties', 'user')->get(); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $landlord = Landlord::findOrFail($id); $landlord->delete(); return redirect('landlord'); }