/**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function hostelhome($hostel_name)
 {
     $hostel = Hostels::where('url_name', '=', $hostel_name)->first();
     $hi = H_Incharge::where('hostel_id', '=', $hostel->id)->get();
     $hostels = Hostels::all();
     return view('Hostels.home', ['details' => $hostel, 'hostels' => $hostels, 'selected_hostel' => $hostel_name, 'incharge' => $hi]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $hi = new H_Incharge();
     $hi->name = $request->get('name');
     $hi->hostel_id = $request->get('hostel_id');
     $hi->position = $request->get("position");
     $hi->mail = $request->get('mail');
     $hi->image_url = $request->get('image_url');
     //$request->file('image')->getClientOriginalExtension();
     $destinationPath = base_path() . '/public/Hostel Incharge/';
     // upload path
     $extension = $request->file('image')->getClientOriginalExtension();
     // getting image extension
     $fileName = $hi->image_url . '.' . $extension;
     // renameing image
     $request->file('image')->move($destinationPath, $fileName);
     $hi->save();
     return redirect('h_incharge/create')->with('message', 'Successfully created Hostel Incharge!!');
 }