123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- namespace App\Http\Controllers\Admin;
- use Illuminate\Http\Request;
- use App\Http\Requests;
- use App\Http\Controllers\Controller;
- use App\Models\Employee;
- use App\Models\EmployeeEducation;
- use App\Models\EmployeeDocument;
- use App\Models\EducationLevel;
- use App\Models\DocumentType;
- class EducationController extends Controller
- {
-
- public function index()
- {
- $data['title'] = "Education Level";
- $data['all'] = EducationLevel::orderBy('level_name','ASC')->get();
- return view('admin.education_level.index',$data);
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function create()
- {
- $data['title'] = "Education Level Create";
- return view('admin.education_level.add',$data);
- }
- /**
- * Store a newly created resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\Response
- */
- public function store(Request $request)
- {
- $this->validate($request,[
- 'level_name' => 'required'
- ]);
- $user_id = \Auth::user()->id;
- $edu_level = new EducationLevel;
- $edu_level->level_name = $request->level_name;
- $edu_level->added_by = $user_id;
- $edu_level->status = 1;
- $edu_level->save();
- return redirect()->back()->with('msg','Data Insert Successful!');
- }
- public function edit($id)
- {
- $data['title'] = "Education Level Edit";
- $data['edu_level'] = EducationLevel::find($id);
- return view('admin.education_level.edit',$data);
- }
- /**
- * Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function update(Request $request, $id)
- {
- $this->validate($request,[
- 'level_name' => 'required'
- ]);
- $user_id = \Auth::user()->id;
- $edu_level = EducationLevel::find($id);
- $edu_level->level_name = $request->level_name;
- $edu_level->updated_by = $user_id;
- $edu_level->save();
- return redirect('admin/education_level')->with('msg','Data Update Successful!');
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function destroy($id)
- {
- EducationLevel::whereId($id)->delete();
- return redirect('admin/education_level')->with('msg','Successfully Deleted!');
- }
- public function statusUpdate($id)
- {
- $edu_info = EducationLevel::find($id);
- if($edu_info->status == 0){
- $edu_info->status = 1;
- $status = 'published';
- }else{
- $edu_info->status = 0;
- $status = 'unpublished';
- }
- $user_id = \Auth::user()->id;
- $edu_info->approved_by = $user_id;
- $edu_info->update();
- }
- }
|