public function getIndex() { $uid = Auth::org()->get()->uid; $missing_count = Missing::where('created_by', '=', $uid)->count(); $found_count = Found::where('created_by', '=', $uid)->count(); $data = array('missing_count' => $missing_count, 'found_count' => $found_count, 'total_reports_count' => (int) $missing_count + (int) $found_count); return View::make('organisation.home')->with('data', $data); }
public function getRedirect($id) { $data = Missing::where('uid', $id)->first()->id; if (empty($data)) { $data = Found::where('uid', $id)->first()->id; return Redirect::to('admin/found/edit-p/' . $data); } return Redirect::to('admin/missing/edit-p/' . $data); }
public function postFound() { $input = Input::all(); $logged_in_data = Auth::org()->get(); $rules = array('name' => 'required|alpha_spaces', 'dob' => 'date_format:m/d/Y', 'family_name' => 'alpha_spaces', 'phone_number' => 'numeric', 'police_station_number' => 'numeric', 'enquiry_office_number' => 'numeric', 'found_date' => 'date_format:m/d/Y', 'gender' => 'required'); $v = Validator::make(Input::all(), $rules); if ($v->fails()) { return Redirect::back()->withInput(Input::all())->withErrors($v); } $input = $this->check_images_and_upload($input); $input['dob'] = GlobalFunc::set_date_format(Input::get('dob')); $input['found_date'] = GlobalFunc::set_date_format(Input::get('found_date')); $input['report_type'] = 'Found'; $input['created_by'] = $logged_in_data->uid; $uid = strtoupper(Str::random(3)) . '_' . time(); $input['uid'] = $uid; Found::create($input); return Redirect::back()->with('success', 'Record Successfully Inserted'); }
public function getSuccess($id) { $data = Found::find($id); return View::make('admin.success_view_found')->with('data', $data); }