public function postApply()
 {
     $user = \User::getUser();
     if (!$user->hasAccess('contractor')) {
         return \Response::json(['type' => 'danger', 'message' => 'Only contractors can submit a timesheet']);
     }
     $_hash = new Hash();
     $_hash = $_hash->getHasher();
     $job = \Job::findJobById($_hash->decode(trim(\Input::get('job'))));
     if (!$job) {
         return \Response::json(['type' => 'danger', 'message' => 'Sorry, that job does not longer exists in our database.']);
     }
     if (!$job->is_active || $job->status !== 'open') {
         return \Response::json(['type' => 'danger', 'message' => 'The job is not available for applying.']);
     }
     try {
         $contractor = \Contractor::getContractor();
         $application = \Contractor::applyForJob($contractor, $job);
         return \Response::json(['type' => 'success', 'message' => 'Your application has been submitted, you will be notified when you have been selected for the job.']);
     } catch (\Exception $e) {
         return \Response::json(['type' => 'danger', 'message' => env('APP_DEBUG') ? $e->getMessage() : 'Error, please contact webmaster.']);
     }
 }