Ejemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $http)
 {
     // if($http->filter === '')
     $resident = Resident::find(Auth::user()->id);
     $bills = $resident->bills;
     return view('bills.index', compact('bills'));
 }
Ejemplo n.º 2
0
 public function postAddResident(Request $http)
 {
     $resident = Resident::find($http->resident_id);
     $residence = Residence::find($http->residence_id);
     $query = 'select * from calcdb.residence_resident where resident_id = ? and residence_id = ?';
     $statement = DB::select($query, array($resident->id, $residence->id));
     // Create relationship between residence and newly added resident
     $residence->residents()->attach($resident->id);
     return response()->json(['status' => 200, 'query' => $query]);
 }
Ejemplo n.º 3
0
 public function getOwner()
 {
     return Resident::find($this->resident_id);
 }
 public function changeProject(Request $request)
 {
     $resident = Resident::find($request->get('residente_id'));
     foreach ($request->get('project_id') as $project) {
         $resident->proyectos()->attach($project);
     }
     Session::flash('message', 'Residente ' . $request->name . ' se le asignaron nuevos proyectos');
     return redirect()->to('admin/residentes');
 }