/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { // $age = Age::find($id); //return $gender; if (count($age) > 0) { $statusCode = 200; $response = ['id' => $age->id, 'Age' => $age->age]; } else { $response = ["error" => "Age doesn`t exist"]; $statusCode = 404; } return response($response, $statusCode)->header('Content-Type', 'application/json'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit() { // $gender = Gender::lists('gender', 'id'); $age = Age::lists('age', 'id'); $occupation = Occupation::lists('occupation', 'id'); $country = Country::orderBy('country')->lists('country', 'id'); //for alphabetic order $education = Education::lists('education', 'id'); //return Auth::User()->profile; return view('user.edit', compact('gender', 'age', 'occupation', 'country', 'education')); }
public function run() { DB::table('ages')->delete(); Age::create(['id' => '1', 'age' => 'Under 12']); Age::create(['id' => '2', 'age' => '12-17']); Age::create(['id' => '3', 'age' => '18-24']); Age::create(['id' => '4', 'age' => '25-34']); Age::create(['id' => '5', 'age' => '35-44']); Age::create(['id' => '6', 'age' => '45-54']); Age::create(['id' => '7', 'age' => '55-64']); Age::create(['id' => '8', 'age' => '65-74']); Age::create(['id' => '9', 'age' => '75 older']); }
Route::get('dropdown', function () { return view('dropdown'); }); Route::get('form', function () { return view('form'); }); Route::post('post_to_me', function () { echo 'hit here'; }); Route::get('categories', function () { $categories = \App\Vaccine::all(); return View::make('index')->with('vaccines', $vaccines); }); Route::get('/ajax-subcat', function () { $cat_id = Input::get('cat_id'); $subcategories = \App\Age::where('category_id', '=', $cat_id)->get(); return Response::json($Age); }); Route::get('/admin/ancu/health', function () { $title = "testing healthinfo page"; return view('admin.ancu.healthinfo', compact('title')); }); Route::group(['prefix' => 'admin'], function () { # Admin Dashboard Route::get('/', 'AdminDashboardController@index'); # Department Management Route::resource('departments', 'AdminDepartmentsController'); Route::resource('ancu', 'ancuController'); # Staff Management Route::resource('staffs', 'AdminStaffsController'); #Client Management