diff --git a/app/Http/Controllers/Admin/InfoBloksController.php b/app/Http/Controllers/Admin/InfoBloksController.php index 93e5c8e..e90363f 100644 --- a/app/Http/Controllers/Admin/InfoBloksController.php +++ b/app/Http/Controllers/Admin/InfoBloksController.php @@ -15,7 +15,9 @@ class InfoBloksController extends Controller */ public function index() { - $infobloks = infobloks::query()->active()->orderByDesc('sort')->orderBy('name')->paginate(15); + $infobloks = infobloks::query()-> + //active()-> + orderByDesc('sort')->orderBy('name')->paginate(15); return view('admin.infobloks.index', compact('infobloks')); } @@ -84,7 +86,7 @@ class InfoBloksController extends Controller */ public function destroy(infobloks $infoblok) { - $infoblok->update(['is_remove' => 1]); + $infoblok->delete(); // update(['is_remove' => 1]); return redirect()->route('admin.infobloks.index'); } } diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php index db24174..394d6d5 100644 --- a/app/Http/Controllers/Admin/UsersController.php +++ b/app/Http/Controllers/Admin/UsersController.php @@ -45,6 +45,12 @@ class UsersController extends Controller } } + public function user_delete(User $user) { + $id = $user->delete(); + + return redirect()->route('admin.users')->with('Пользователь был удален из системы'); + } + public function index_bd(Request $request) { $title = 'Админка - Пользователи базы данных'; diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index ad4da01..7867b80 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\Ad_employer; use App\Models\Employer; use Illuminate\Http\Request; @@ -52,6 +53,10 @@ class CompanyController extends Controller $title = $company[0]->name_company; - return view('info_company_new', compact('company', 'user_id', 'title')); + $ads = Ad_employer::query()->with('jobs')->with('jobs_code')-> + OrderByDesc('id')-> + where('employer_id', '=', $company[0]->id)->paginate(2); + + return view('info_company_new', compact('company', 'user_id', 'title', 'ads')); } } diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 42eecd3..55e8bd3 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -164,18 +164,15 @@ class EmployerController extends Controller if (Auth()->user()->is_public) { $categories = Category::query()->active()->get(); - $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> where('is_remove', '=', '0')-> where('is_bd', '=', '0')-> get(); $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> - WhereHas('users', function (Builder $query) use ($id) { $query->Where('id', $id); })->get(); - return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); } else { return redirect()->route('employer.cabinet_vacancie_danger'); @@ -249,18 +246,19 @@ class EmployerController extends Controller public function vacancy_edit(Ad_employer $ad_employer) { $id = Auth()->user()->id; $Positions = Category::query()->where('is_remove', '=', '0')->get(); - $jobs = Job_title::query()->OrderBy('name')-> - where('is_remove', 0)->where('is_bd', '=' , '0')->get(); - - $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> - where('user_id', $id)->first(); + $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')->get(); + $Employer = Employer::query()->with('users')->with('ads')-> + with('flots')->where('user_id', $id)->first(); return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); } // Сохранение-редактирование записи public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { $params = $request->all(); + $params_job["job_title_id"] = $params['job_title_id']; //$jobs['flot'] = $params['flot']; //$jobs['job_title_id'] = $params['job_title_id']; @@ -268,6 +266,7 @@ class EmployerController extends Controller //unset($params['job_title_id']); $ad_employer->update($params); + $ad_employer->jobs()->sync($request->get('job_title_id')); //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> // where('ad_employer_id', $ad_employer->id)->first(); diff --git a/resources/views/admin/users/index.blade.php b/resources/views/admin/users/index.blade.php index 1cd6621..dadc982 100644 --- a/resources/views/admin/users/index.blade.php +++ b/resources/views/admin/users/index.blade.php @@ -62,6 +62,7 @@ Админ Менеджер Дата регист. + Удаление @@ -111,6 +112,10 @@ {{ date('d.m.Y', strtotime($user->created_at)) }} + + + Del + @endforeach diff --git a/resources/views/employers/edit_vacancy.blade.php b/resources/views/employers/edit_vacancy.blade.php index eac6f0f..4a4a228 100644 --- a/resources/views/employers/edit_vacancy.blade.php +++ b/resources/views/employers/edit_vacancy.blade.php @@ -110,10 +110,10 @@ -
+ --> + +
+ +
+
+ +
+
+
+
@@ -158,24 +185,24 @@
-
+
Назад diff --git a/resources/views/info_company_new.blade.php b/resources/views/info_company_new.blade.php index 5eca8af..fbe307d 100644 --- a/resources/views/info_company_new.blade.php +++ b/resources/views/info_company_new.blade.php @@ -198,8 +198,7 @@
- @foreach ($company[0]->ads as $job) - @foreach ($job->ad_job as $item) + @foreach ($ads as $job)
@if (!empty($company[0]->logo)) @@ -208,30 +207,37 @@ {{ $job->name }} @endif {{ $job->name }} +
-
{{ $item->flot }}
+
-
- {{ $item->job_title->name }} -
-
-

Зарплата:{{ $item->min_salary }} - {{ $item->max_salary }}р + {{ $item->sytki }} суточные.

-

Контракт: {{ $item->period }} мес.

-
+ @if ((isset($job->jobs)) && ($job->jobs->count())) + @foreach($job->jobs as $item) + + {{ $item->name }} + + @endforeach + @endif +
-
+
Звонить по вопросам на:
@@ -247,12 +253,16 @@ {{ $job->email }}
+ @if ((isset($job->jobs)) && ($job->jobs->count()))
- #{{ $item->job_title->name }} + @foreach ($job->jobs as $item) + #{{ $item->name }} + @endforeach
+ @endif
- @@ -269,8 +279,11 @@
- @endforeach @endforeach + +
+ {{ $ads->onEachSide(0)->appends($_GET)->links('paginate') }} +