public function postPublish() { $msg = 'Report Successfully Published'; $inputs = Input::except('notify'); foreach (Input::all() as $key => $single_input) { if (empty($single_input) && (stristr($key, 'state') || stristr($key, 'city'))) { unset($inputs[$key]); } } $inputs['dob'] = GlobalFunc::set_date_format(Input::get('dob')); $inputs['found_date'] = GlobalFunc::set_date_format(Input::get('found_date')); if (!Input::hasFile('kid_image')) { unset($inputs['kid_image']); } else { $file = Input::file('kid_image'); $destination_path = 'admin/images/upload/'; $filename = str_random(15) . '.' . $file->getClientOriginalExtension(); $file->move($destination_path, $filename); $inputs['kid_image'] = $destination_path . $filename; } if (Input::get('clicked') == 'Success') { // if the report is marked as a success $inputs['status'] = 9; $msg = 'Report Successfully Marked As Success'; } else { //if the report is updated or published $inputs['status'] = 1; } unset($inputs['clicked']); Found::where('id', '=', Input::get('id'))->update($inputs); return Redirect::to('admin/found/published')->with('success', $msg); }
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); }