Ejemplo n.º 1
0
 public function download(Request $request)
 {
     $id = $request->id;
     $registration = Registration::find($id);
     $pathToFile = base_path() . '/Upload/' . "{$registration->file_name}";
     return response()->download($pathToFile);
 }
Ejemplo n.º 2
0
 public function show($registration_id)
 {
     // TODO: just show what change . previous value and current value
     // show the student id
     $registration = Registration::find($registration_id);
     $party = Party::find($registration->student);
     $data['firstname'] = $party->firstname;
     $data['lastname'] = $party->lastname;
     $data['middlename'] = $party->middlename;
     $data['id'] = $registration_id;
     return view('registrar.show_registration', $data);
 }
Ejemplo n.º 3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $registration = Registration::find($id);
     $postData = Input::all();
     $messages = ['program.required' => 'Enter Program', 'specialty.required' => 'Enter Specialty', 'period.required' => 'Enter Period', 'user_id.required' => 'Enter User Id'];
     $rules = ['program' => 'required|integer|min:1|max:3', 'specialty' => 'required|integer|min:1|max:3', 'period' => 'required|integer|min:1|max:3', 'user_id' => 'required|integer|min:1'];
     $validator = Validator::make($postData, $rules, $messages);
     if ($validator->fails()) {
         // send back to the page with the input data and errors
         return Response::json(['Error' => ['message' => $validator->messages(), 'status_code' => 200]], 200);
     } else {
         // Do your stuff here.
         // send back to the page with success message
         return Response::json(['Success' => ['message' => 'Record Save Exits', 'status_code' => 200]], 200);
     }
     $registration->save(Input::all());
     return "Sucess updating user #" . $registration->id;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $department = Registration::find($id);
     $department->delete();
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     return Registration::find($id)->toJson();
 }