/**
  * Accept job from seeker
  *
  * @return Response
  */
 public function acceptJob()
 {
     $job_id = Input::get('job_id');
     $seeker_id = Input::get('seeker_id');
     //accept job, create accepted_job
     $accepted_job = new AcceptedJob();
     $accepted_job->job_id = $job_id;
     $accepted_job->seeker_id = $seeker_id;
     $accepted_job->save();
     //delete request
     $job_request = JobRequest::find($job_id, $seeker_id);
     //$job_request->delete();
     $query = "DELETE FROM job_request ";
     $query = $query . "WHERE job_id = " . $job_id . " and seeker_id = " . $seeker_id;
     DB::select(DB::raw($query));
     // add notification to the freelacer
     $freelancer_id = User::find(FreelancerInfo::find(Job::find($job_id)->freelancer_info_id)->user_info_id)->id;
     $freelancer_name = User::find($freelancer_id)->name;
     $job_name = Job::find($job_id)->judul;
     $notification = new Notification();
     $notification->user_id = $seeker_id;
     $notification->notif = "Tawaran job " . $job_name . " telah diterima oleh freelancer " . $freelancer_name;
     $notification->type = 2;
     $notification->save();
     return Redirect::to('show-job-request/');
 }
 public function directToProfile($id)
 {
     $user_info = UserInfo::find($id);
     $users = User::find($id);
     $alamat = $user_info->alamat;
     $tanggal_lahir = $user_info->tanggal_lahir;
     $jenis_kelamin = $user_info->jenis_kelamin;
     $nama = $users->name;
     $user_info = UserInfo::find($id);
     $freelancer_info = FreelancerInfo::find($user_info->user_id);
     $skills = FreelancerInfoSkill::where('freelancer_info_id', $id)->get();
     return View::make('profile')->with('user_info', $user_info)->with('users', $users)->with('skills', $skills)->with('id', $id);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     // load the create form (app/views/nerds/create.blade.php)
     $id = Auth::user()->id;
     $category = Category::all();
     if (FreelancerInfo::where('user_info_id', '=', $id)->exists()) {
         return View('job.create')->with('category', $category);
     } else {
         $newFreelancerInfo = new FreelancerInfo();
         $newFreelancerInfo->user_info_id = $id;
         $newFreelancerInfo->available = true;
         $newFreelancerInfo->save();
         return View('job.create')->with('category', $category);
     }
 }