/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //load the home page of all models for resume entry
     $educations = Education::orderBy('graduationyear', 'desc')->get();
     $skillcategories = SkillCategory::orderBy('title', 'asc')->get();
     $jobs = Job::orderBy('currentlyemployed', 'desc')->orderBy('enddate', 'desc')->get();
     $article = Article::findOrFail('1');
     //get the summary article with id of 1
     return view('admin.index', compact('educations', 'jobs', 'skillcategories', 'article'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $skill = Skill::findOrFail($id);
     $skill_categories = SkillCategory::lists('title', 'id');
     return view('skills.edit', compact('skill', 'skill_categories'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $skillcategory = SkillCategory::findOrFail($id);
     $skills = SkillCategory::findOrFail($id)->skills()->get();
     if ($skills->isEmpty()) {
         $skillcategory->delete();
         return redirect('skillcategories')->with('success', 'Successfully deleted category!');
     } else {
         //can't delete the category until all of the skills are removed or changed
         return redirect('skillcategories')->with('error', 'There was a problem removing the category, since there are existing skills tied to the category.');
     }
 }