Skip to content

Commit

Permalink
Add Job Recommandation System
Browse files Browse the repository at this point in the history
  • Loading branch information
tarikmanoar committed Nov 24, 2019
1 parent 3a79db4 commit 756ca0d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
10 changes: 3 additions & 7 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 32 additions & 2 deletions app/Http/Controllers/Kajki/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,37 @@ public function index()

public function show($id, Job $job)
{
return view('jobs.show', compact('job'));
$data = [];
//Jobs Base on Category
$jobsByCats = Job::latest()
->where('category_id', $job->category_id)
->where('status', 1)
->whereDate('last_date', '>', date('Y-m-d'))
->where('id', '!=', $job->id)
->limit(3)
->get();
array_push($data, $jobsByCats);
//Jobs Base on Company
$jobsByComps = Job::latest()
->where('company_id', $job->company_id)
->where('status', 1)
->whereDate('last_date', '>', date('Y-m-d'))
->where('id', '!=', $job->id)
->limit(3)
->get();
array_push($data, $jobsByComps);

//Jobs Base on Positions
$jobsByPosition = Job::latest()
->where('position', 'LIKE', '%' . $job->position . '%')
->where('status', 1)
->whereDate('last_date', '>', date('Y-m-d'))
->where('id', '!=', $job->id)
->limit(3)
->get();
array_push($data, $jobsByPosition);
// dd($data);
return view('jobs.show', compact('job','jobsByComps','jobsByCats'));
}

public function create()
Expand Down Expand Up @@ -156,7 +186,7 @@ public function allJobs(Request $request)
->where('title', 'LIKE', '%' . $keyword . '%')
->orWhere('job_type', $job_type)
->orWhere('category_id', $category_id)
->orWhere('address','LIKE','%'.$address.'%' )
->orWhere('address', 'LIKE', '%' . $address . '%')
->paginate(10);
return view('jobs.allJobs', compact('allJobs'));
} else {
Expand Down
12 changes: 11 additions & 1 deletion resources/views/jobs/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@ class="img-fluid
class="btn btn-primary py-2 px-4">Visit Company Page</a></p>
</div>
</div>

@foreach($jobsByCats as $jobData)
<div class="card col-lg-3 col-md-12 mr-5">
<div class="card-body">
<p class="badge badge-info">{{$jobData->job_type}}</p>
<h5 class="card-title">{{$jobData->position}}</h5>
<p class="card-text">{{Str::limit($jobData->description,90)}}</p>
<a href="{{route('jobs.show',[$jobData->id,$jobData->slug])}}" class="btn
btn-primary">Apply</a>
</div>
</div>
@endforeach
</div>
</div>
</div>
Expand Down

0 comments on commit 756ca0d

Please sign in to comment.