diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 882a87b..cd7a690 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,13 +2,9 @@ - - - - + - @@ -232,7 +228,7 @@ file://$PROJECT_DIR$/resources/views/jobs/show.blade.php - 178 + 188 diff --git a/app/Http/Controllers/Kajki/JobController.php b/app/Http/Controllers/Kajki/JobController.php index d5d3dab..8275935 100644 --- a/app/Http/Controllers/Kajki/JobController.php +++ b/app/Http/Controllers/Kajki/JobController.php @@ -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() @@ -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 { diff --git a/resources/views/jobs/show.blade.php b/resources/views/jobs/show.blade.php index b2ee0a9..e20d690 100644 --- a/resources/views/jobs/show.blade.php +++ b/resources/views/jobs/show.blade.php @@ -104,7 +104,17 @@ class="img-fluid class="btn btn-primary py-2 px-4">Visit Company Page

- + @foreach($jobsByCats as $jobData) +
+
+

{{$jobData->job_type}}

+
{{$jobData->position}}
+

{{Str::limit($jobData->description,90)}}

+ Apply +
+
+ @endforeach