diff --git a/app/Http/Controllers/Admin/EmployersController.php b/app/Http/Controllers/Admin/EmployersController.php index bb438e5..9ae013d 100644 --- a/app/Http/Controllers/Admin/EmployersController.php +++ b/app/Http/Controllers/Admin/EmployersController.php @@ -12,16 +12,12 @@ use App\Models\Flot; use App\Models\Static_ad; use App\Models\User; use Illuminate\Http\Request; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; class EmployersController extends Controller { public function index(Request $request) { - //$all_employer = User::where('is_worker', '0')->count(); - $all_public = -1; - $all_status = -1; if ($request->ajax()) { $user = User::find($request->id); $request->offsetUnset('id'); @@ -58,30 +54,25 @@ class EmployersController extends Controller if (isset($request->find)) { $find_key = $request->find; $users = $users->where(function($query) use($find_key) { - $query->Where('users.name', 'LIKE', "%$find_key%") + $query->where('users.name', 'LIKE', "%$find_key%") ->orWhere('emp.email', 'LIKE', "%$find_key%") - ->orWhere('emp.telephone', 'LIKE', "%$find_key%"); + ->orWhere('emp.telephone', 'LIKE', "%$find_key%") + ->orWhere('emp.name_company', 'LIKE', "%$find_key%") + ; }); } - //DB::enableQueryLog(); $all_current = $users->count(); $users = $users->paginate(15); - //dd(DB::getQueryLog()); $select_category = CategoryEmp::query()->active()->get(); if ($request->ajax()) { return view('admin.employer.index_ajax', compact('users')); } else { - return view('admin.employer.index', compact('users', - 'find_key', - 'find_cat', - 'all_employer', - 'all_public', - 'all_status', - 'all_current', - 'select_category')); + return view('admin.employer.index', compact('users', 'find_key', 'find_cat', 'all_employer', + 'all_public', 'all_status', 'all_current', 'select_category' + )); } } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 2b77df1..2679956 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -39,39 +39,9 @@ class MainController extends Controller ->GroupBy('categories.id') ->get(); - //$Position = Category::query()->where('is_remove', '=', '0')->get(); $Job_title = Job_title::query()->where('is_remove', '=', '0')-> where('is_bd', '=', '0')->orderBy('name')->get(); - /*$BigFlot = Array(); - foreach ($Position as $position) { - $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> - orderBy('job_titles.sort')-> - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> - where('position_ship', "$position->name")-> - groupby('job_title_id','position_ship')-> - get(); - } - $BigFlot = Array(); - foreach ($Position as $position) { - $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { - $query->OrderBy('sort'); - }])->whereHas('job_title', function ($query) use ($position) { - $query->where('position_id', $position->id); - })-> - distinct('job_title_id')-> - get(); - }*/ - /*$BigFlot = Array(); - foreach ($Position as $position) { - $BigFlot[$position->id] = DB::table('ad_jobs')-> - selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> - orderByDesc('job_titles.sort')-> - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> - where('job_titles.position_id', $position->id)-> - groupby('job_title_id')-> - get(); - }*/ $Data = DB::table('job_titles')-> selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> where('categories.is_remove', '=', '0')-> @@ -177,36 +147,6 @@ class MainController extends Controller $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); - //$Position = Category::query()->where('is_remove', '=', '0')->get(); - - /*$BigFlot = Array(); - foreach ($Position as $position) { - $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> - orderBy('job_titles.sort')-> - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> - where('position_ship', "$position->name"); - if (($request->has('job')) && ($request->get('job') > 0)) { - $War_flot = $War_flot->where('job_title_id', $request->get('job')); - } - $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); - $BigFlot[] = $War_flot; - }*/ - /* - $BigFlot = Array(); - foreach ($Position as $position) { - $WarFlot = DB::table('ad_jobs')-> - selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> - orderByDesc('job_titles.sort')-> - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> - where('job_titles.position_id', $position->id); - if (($request->has('job')) && ($request->get('job') > 0)) { - $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); - } - $WarFlot = $WarFlot->groupby('job_title_id')->get(); - $BigFlot[] = $WarFlot; - } - */ - $Data = DB::table('job_titles')-> selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> where('categories.is_remove', '=', '0')-> @@ -282,7 +222,7 @@ class MainController extends Controller $Query_count = $Query->count(); - $Query = $Query->OrderByDesc('updated_at')->paginate(3); + $Query = $Query->OrderByDesc('updated_at')->paginate(10); $Reclama = reclame::query()->get(); diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 8cb921a..f234cc6 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -21,29 +21,25 @@