Commit 8c73c7b41010936aae7382e57998d5a922571670

Authored by Андрей Ларионов
1 parent c84db52439

Категории вакансий и резюме. Модель. Контроллер.

Showing 12 changed files with 751 additions and 8 deletions Side-by-side Diff

app/Http/Controllers/Admin/CategoryController.php
... ... @@ -0,0 +1,95 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Admin;
  4 +
  5 +use App\Http\Controllers\Controller;
  6 +use App\Http\Requests\CategoryRequest;
  7 +use App\Models\Category;
  8 +use Illuminate\Http\Request;
  9 +use Illuminate\Support\Facades\Auth;
  10 +use Illuminate\Support\Facades\Storage;
  11 +
  12 +class CategoryController extends Controller
  13 +{
  14 + /**
  15 + * Display a listing of the resource.
  16 + *
  17 + * @return \Illuminate\Http\Response
  18 + */
  19 + public function index()
  20 + {
  21 + $category = Category::query()->paginate(15);
  22 + return view('admin.category.index', compact('category'));
  23 + }
  24 +
  25 + /**
  26 + * Show the form for creating a new resource.
  27 + *
  28 + * @return \Illuminate\Http\Response
  29 + */
  30 + public function create()
  31 + {
  32 + return view('admin.category.add');
  33 + }
  34 +
  35 + /**
  36 + * Store a newly created resource in storage.
  37 + *
  38 + * @param \Illuminate\Http\Request $request
  39 + * @return \Illuminate\Http\Response
  40 + */
  41 + public function store(CategoryRequest $request)
  42 + {
  43 + Category::create($request->all());
  44 + return redirect()->route('admin.categories.index');
  45 + }
  46 +
  47 + /**
  48 + * Display the specified resource.
  49 + *
  50 + * @param \App\Models\Category $category
  51 + * @return \Illuminate\Http\Response
  52 + */
  53 + public function show(Category $category)
  54 + {
  55 + //
  56 + }
  57 +
  58 + /**
  59 + * Show the form for editing the specified resource.
  60 + *
  61 + * @param \App\Models\Category $category
  62 + * @return \Illuminate\Http\Response
  63 + */
  64 + public function edit(Category $category)
  65 + {
  66 + return view('admin.category.edit', compact('category'));
  67 + }
  68 +
  69 + /**
  70 + * Update the specified resource in storage.
  71 + *
  72 + * @param \Illuminate\Http\Request $request
  73 + * @param \App\Models\Category $category
  74 + * @return \Illuminate\Http\Response
  75 + */
  76 + public function update(CategoryRequest $request, Category $category)
  77 + {
  78 + $category->update($request->all());
  79 + return redirect()->route('admin.categories.index');
  80 + }
  81 +
  82 + /**
  83 + * Remove the specified resource from storage.
  84 + *
  85 + * @param \App\Models\Category $category
  86 + * @return \Illuminate\Http\Response
  87 + */
  88 + public function destroy(Category $category)
  89 + {
  90 + if (Auth::user()->id == 1) {
  91 + $category->delete();
  92 + }
  93 + return redirect()->route('admin.categories.index');
  94 + }
  95 +}
app/Http/Controllers/Admin/EmployersController.php
... ... @@ -6,6 +6,8 @@ use App\Http\Controllers\Controller;
6 6 use App\Models\Employer;
7 7 use App\Models\User;
8 8 use Illuminate\Http\Request;
  9 +use Illuminate\Support\Facades\Storage;
  10 +use Illuminate\Support\Facades\Validator;
9 11  
10 12 class EmployersController extends Controller
11 13 {
... ... @@ -27,4 +29,62 @@ class EmployersController extends Controller
27 29 public function form_update_employer(Employer $employer) {
28 30 return view('admin.employer.edit', compact('employer'));
29 31 }
  32 +
  33 + public function update_employer(Employer $employer, Request $request)
  34 + {
  35 + $params = $request->all();
  36 + unset($params['logo']);
  37 + unset($params['telephone']);
  38 + unset($params['email']);
  39 + unset($params['address']);
  40 + unset($params['site']);
  41 +
  42 + $rules = [
  43 + 'name' => 'required|string|max:255',
  44 + ];
  45 +
  46 + $messages = [
  47 + 'required' => 'Укажите обязательное поле «:attribute»',
  48 + 'confirmed' => 'Пароли не совпадают',
  49 + 'email' => 'Введите корректный email',
  50 + 'min' => [
  51 + 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
  52 + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
  53 + ],
  54 + 'max' => [
  55 + 'string' => 'Поле «:attribute» должно быть не больше :max символов',
  56 + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
  57 + ],
  58 + ];
  59 +
  60 + $validator = Validator::make($params, $rules, $messages);
  61 +
  62 + if ($validator->fails()) {
  63 + return back()->withErrors($validator)->withInput(); //->route('admin.register')
  64 +
  65 + } else {
  66 +
  67 + //$user = User::find($employer->user_id);
  68 + $user_id = $employer->user_id;
  69 + $employer->telephone = $request->telephone;
  70 + $employer->email = $request->email;
  71 + $employer->address = $request->address;
  72 + $employer->site = $request->site;
  73 + $employer->text = $request->text;
  74 +
  75 + if ($request->has('logo')) {
  76 + if (!empty($employer->logo)) {
  77 + Storage::delete($employer->logo);
  78 + }
  79 + $employer->logo = $request->file('logo')->store("employer/$user_id", 'public');
  80 + }
  81 + $employer->save();
  82 +
  83 + $user = User::find($user_id);
  84 + $user->update($params);
  85 +
  86 + return redirect()->route('admin.employer-profile', ['employer' => $employer->id])
  87 + ->with('success', 'Данные были успешно сохранены');
  88 + }
  89 + }
30 90 }
app/Http/Requests/CategoryRequest.php
... ... @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Requests;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class CategoryRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array<string, mixed>
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + 'name' => 'required|min:3|max:255',
  28 + ];
  29 + }
  30 +
  31 + public function messages() {
  32 + return [
  33 + 'required' => 'Поле :attribute обязательно для ввода',
  34 + 'min' => [
  35 + 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
  36 + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
  37 + ],
  38 + 'max' => [
  39 + 'string' => 'Поле «:attribute» должно быть не больше :max символов',
  40 + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
  41 + ],
  42 +
  43 + ];
  44 + }
  45 +}
app/Models/Category.php
... ... @@ -8,4 +8,8 @@ use Illuminate\Database\Eloquent\Model;
8 8 class Category extends Model
9 9 {
10 10 use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'name',
  14 + ];
11 15 }
resources/views/admin/category/add.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Добавление категории'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.categories.store') }}">
  5 + @include('admin.category.form')
  6 + </form>
  7 +@endsection
resources/views/admin/category/edit.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Редактирование категории'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.categories.update', ['category' => $category->id]) }}">
  5 + @include('admin.category.form')
  6 + </form>
  7 +@endsection
resources/views/admin/category/form.blade.php
... ... @@ -0,0 +1,28 @@
  1 +@csrf
  2 +
  3 +@isset($category)
  4 + @method('PUT')
  5 +@endisset
  6 +
  7 +<div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  8 + <label class="block text-sm">
  9 + <span class="text-gray-700 dark:text-gray-400">Имя категории</span>
  10 + <input name="name" id="name"
  11 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  12 + placeholder="Имя категории" value="{{ old('name') ?? $category->name ?? '' }}"
  13 + />
  14 + @error('name')
  15 + <span class="text-xs text-red-600 dark:text-red-400">
  16 + {{ $message }}
  17 + </span>
  18 + @enderror
  19 + </label><br>
  20 +
  21 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  22 + <div>
  23 + <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  24 + Сохранить
  25 + </button>
  26 + </div>
  27 + </div>
  28 +</div>
resources/views/admin/category/index.blade.php
... ... @@ -0,0 +1,91 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Категории'])
  2 +
  3 +@section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('click', '.checkban', function () {
  7 + var this_ = $(this);
  8 + var value = this_.val();
  9 + var ajax_block = $('#ajax_block');
  10 + var bool = 0;
  11 +
  12 + if(this.checked){
  13 + bool = 1;
  14 + } else {
  15 + bool = 0;
  16 + }
  17 +
  18 + $.ajax({
  19 + type: "GET",
  20 + url: "{{ url()->full()}}",
  21 + data: "id=" + value + "&is_ban=" + bool,
  22 + success: function (data) {
  23 + console.log('Обновление таблицы пользователей ');
  24 + //data = JSON.parse(data);
  25 + console.log(data);
  26 + ajax_block.html(data);
  27 + },
  28 + headers: {
  29 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  30 + },
  31 + error: function (data) {
  32 + console.log('Error: ' + data);
  33 + }
  34 + });
  35 + });
  36 +
  37 + });
  38 + </script>
  39 +@endsection
  40 +
  41 +@section('content')
  42 +
  43 + <a href="{{ route('admin.categories.create') }}" style="width: 210px" class="px-5 py-3 font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  44 + Добавить категорию
  45 + </a>
  46 + <br>
  47 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  48 +
  49 + <div class="w-full overflow-x-auto">
  50 + <table class="w-full whitespace-no-wrap">
  51 + <thead>
  52 + <tr
  53 + class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800"
  54 + >
  55 + <th class="px-4 py-3">№</th>
  56 + <th class="px-4 py-3">Название категории</th>
  57 + <th class="px-4 py-3">Дата создания</th>
  58 + <th class="px-4 py-3">Редактировать</th>
  59 + </tr>
  60 + </thead>
  61 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  62 + @foreach($category as $cat)
  63 + <tr class="text-gray-700 dark:text-gray-400">
  64 + <td class="px-4 py-3">
  65 + {{$cat->id}}
  66 + </td>
  67 + <td class="px-4 py-3">
  68 + {{$cat->name}}
  69 + </td>
  70 + <td class="px-4 py-3">
  71 + {{$cat->created_at}}
  72 + </td>
  73 + <td class="px-4 py-3 text-sm">
  74 + <form action="{{ route('admin.categories.destroy', ['category' => $cat->id]) }}" method="POST">
  75 + <a href="{{ route('admin.categories.edit', ['category' => $cat->id]) }}">Изменить</a> |
  76 + @csrf
  77 + @method('DELETE')
  78 + <input class=" btn-danger" type="submit" value="Удалить">
  79 + </form>
  80 + </td>
  81 + </tr>
  82 + @endforeach
  83 + </tbody>
  84 + </table>
  85 + </div>
  86 +
  87 + <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
  88 + <?=$category->appends($_GET)->links('admin.pagginate'); ?>
  89 + </div>
  90 + </div>
  91 +@endsection
resources/views/admin/employer/edit.blade.php
... ... @@ -4,16 +4,16 @@
4 4 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
5 5 Работодатель-пользователь: "{{$employer->users->name_man}} ({{$employer->user_id}})"
6 6 </h4>
7   - <form method="POST" action="">
  7 + <form method="POST" action="" enctype="multipart/form-data">
8 8 @csrf
9 9 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
10 10 <label class="block text-sm">
11 11 <span class="text-gray-700 dark:text-gray-400">Имя компании</span>
12   - <input name="name_company" id="name_company"
  12 + <input name="name" id="name"
13 13 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
14   - placeholder="Имя компании" value="{{ old('name_company') ?? $employer->name_company ?? '' }}"
  14 + placeholder="Имя компании" value="{{ old('name') ?? $employer->users->name ?? '' }}"
15 15 />
16   - @error('name_company')
  16 + @error('name')
17 17 <span class="text-xs text-red-600 dark:text-red-400">
18 18 {{ $message }}
19 19 </span>
... ... @@ -73,11 +73,42 @@
73 73 </label><br>
74 74  
75 75 <label class="block text-sm">
  76 + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
  77 + Права работодателя:
  78 + </h4>
  79 + <p style="float:left; margin-right: 10px">Просмотр базы резюме </p>
  80 + <input type="hidden" name="is_lookin" value="0" />
  81 + <input name="is_lookin" <? if ($employer->users->is_lookin) echo "checked";?>
  82 + class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
  83 + placeholder="" type="checkbox" value="1"
  84 + /><br>
  85 +
  86 + <p style="float:left; margin-right: 10px">Отправка сообщений</p>
  87 + <input type="hidden" name="is_message" value="0" />
  88 + <input name="is_message" id="is_message" <? if ($employer->users->is_message) echo "checked";?>
  89 + class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
  90 + placeholder="" type="checkbox" value="1"
  91 + /><br>
  92 +
  93 + <p style="float:left; margin-right: 10px">Публикация вакансий</p>
  94 + <input type="hidden" name="is_public" value="0" />
  95 + <input name="is_public" id="is_public" <? if ($employer->users->is_public) echo "checked";?>
  96 + class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
  97 + placeholder="" type="checkbox" value="1"
  98 + /><br>
  99 +
  100 + </label>
  101 +
  102 + <label class="block text-sm">
76 103 <span class="text-gray-700 dark:text-gray-400">Лого</span>
77   - <input name="logo" id="logo"
  104 +
  105 + <input name="logo" id="logo" type="file"
78 106 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
79 107 placeholder="Лого" value=""
80 108 />
  109 + @isset($employer->logo)
  110 + <img src="<?=asset(Storage::url($employer->logo))?>" width="150"/>
  111 + @endisset
81 112 @error('logo')
82 113 <span class="text-xs text-red-600 dark:text-red-400">
83 114 {{ $message }}
... ... @@ -85,12 +116,31 @@
85 116 @enderror
86 117 </label><br>
87 118  
  119 + <label class="block mt-4 text-sm">
  120 + <span class="text-gray-700 dark:text-gray-400">Описание</span>
  121 + <textarea name="text" id="text"
  122 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  123 + rows="3"
  124 + placeholder="Описание компании"
  125 + >{{ old('text') ?? $employer->text ?? '' }}</textarea>
  126 + </label>
  127 +
  128 +
88 129 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
89 130 <div>
90 131 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
91 132 Сохранить
92 133 </button>
93 134 </div>
  135 + <div>
  136 + <a href="">Флот</a>
  137 + </div>
  138 + <div>
  139 + <a href="">Вакансии</a>
  140 + </div>
  141 + <div>
  142 + <a href="">Контакты</a>
  143 + </div>
94 144 </div>
95 145 </div>
96 146 </form>
resources/views/admin/worker/edit.blade.php
... ... @@ -0,0 +1,347 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Редактирование соискателя'])
  2 +
  3 +@section('content')
  4 + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
  5 + Соискатель-пользователь: "{{$worker->users->name_man}} ({{$worker->user_id}})"
  6 + </h4>
  7 + <form method="POST" action="">
  8 + @csrf
  9 + <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  10 + <label class="block text-sm">
  11 + <span class="text-gray-700 dark:text-gray-400">Имя компании</span>
  12 + <input name="name_company" id="name_company"
  13 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  14 + placeholder="Имя компании" value="{{ old('name_company') ?? $employer->name_company ?? '' }}"
  15 + />
  16 + @error('name_company')
  17 + <span class="text-xs text-red-600 dark:text-red-400">
  18 + {{ $message }}
  19 + </span>
  20 + @enderror
  21 + </label><br>
  22 +
  23 + <label class="block text-sm">
  24 + <span class="text-gray-700 dark:text-gray-400">Email</span>
  25 + <input name="email" id="email"
  26 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  27 + placeholder="Почта" value="{{ old('email') ?? $worker->email ?? '' }}"
  28 + />
  29 + @error('email')
  30 + <span class="text-xs text-red-600 dark:text-red-400">
  31 + {{ $message }}
  32 + </span>
  33 + @enderror
  34 + </label><br>
  35 +
  36 + <label class="block text-sm">
  37 + <span class="text-gray-700 dark:text-gray-400">Телефон</span>
  38 + <input name="telephone" id="telephone"
  39 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  40 + placeholder="Телефон" value="{{ old('telephone') ?? $worker->telephone ?? '' }}"
  41 + />
  42 + @error('telephone')
  43 + <span class="text-xs text-red-600 dark:text-red-400">
  44 + {{ $message }}
  45 + </span>
  46 + @enderror
  47 + </label><br>
  48 +
  49 + <label class="block text-sm">
  50 + <span class="text-gray-700 dark:text-gray-400">Адрес</span>
  51 + <input name="address" id="address"
  52 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  53 + placeholder="Адрес" value="{{ old('address') ?? $worker->address ?? '' }}"
  54 + />
  55 + @error('address')
  56 + <span class="text-xs text-red-600 dark:text-red-400">
  57 + {{ $message }}
  58 + </span>
  59 + @enderror
  60 + </label><br>
  61 +
  62 + <label class="block text-sm">
  63 + <span class="text-gray-700 dark:text-gray-400">Город</span>
  64 + <input name="city" id="city"
  65 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  66 + placeholder="Город" value="{{ old('city') ?? $worker->site ?? '' }}"
  67 + />
  68 + @error('city')
  69 + <span class="text-xs text-red-600 dark:text-red-400">
  70 + {{ $message }}
  71 + </span>
  72 + @enderror
  73 + </label><br>
  74 +
  75 + <label class="block text-sm">
  76 + <span class="text-gray-700 dark:text-gray-400">Фото</span>
  77 +
  78 + <input name="photo" id="photo" type="file"
  79 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  80 + placeholder="Фото" value=""
  81 + />
  82 + @isset('photo')
  83 + <img src="<?=asset(Storage::url($worker->photo))?>" width="150"/>
  84 + @endisset
  85 + @error('logo')
  86 + <span class="text-xs text-red-600 dark:text-red-400">
  87 + {{ $message }}
  88 + </span>
  89 + @enderror
  90 + </label><br>
  91 +
  92 + <label class="block text-sm">
  93 + <span class="text-gray-700 dark:text-gray-400">Согласие на обработку данных</span>
  94 + <input name="email_data" id="email_data" <? if ($worker->email_data) echo "checked"; ?>
  95 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  96 + placeholder=""
  97 + />
  98 + @error('email_data')
  99 + <span class="text-xs text-red-600 dark:text-red-400">
  100 + {{ $message }}
  101 + </span>
  102 + @enderror
  103 + </label><br>
  104 +
  105 + <label class="block mt-4 text-sm">
  106 + <span class="text-gray-700 dark:text-gray-400">Описание</span>
  107 + <textarea name="text" id="text"
  108 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  109 + rows="3"
  110 + placeholder="Описание компании"
  111 + >{{ old('text') ?? $worker->text ?? '' }}</textarea>
  112 + </label>
  113 +
  114 +
  115 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  116 + <div>
  117 + <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  118 + Сохранить
  119 + </button>
  120 + </div>
  121 + </div>
  122 + </div>
  123 + </form>
  124 + <!--
  125 + <label class="block mt-4 text-sm">
  126 + <span class="text-gray-700 dark:text-gray-400">
  127 + Requested Limit
  128 + </span>
  129 + <select
  130 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  131 + >
  132 + <option>$1,000</option>
  133 + <option>$5,000</option>
  134 + <option>$10,000</option>
  135 + <option>$25,000</option>
  136 + </select>
  137 + </label>
  138 +
  139 + <label class="block mt-4 text-sm">
  140 + <span class="text-gray-700 dark:text-gray-400">
  141 + Multiselect
  142 + </span>
  143 + <select
  144 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  145 + multiple
  146 + >
  147 + <option>Option 1</option>
  148 + <option>Option 2</option>
  149 + <option>Option 3</option>
  150 + <option>Option 4</option>
  151 + <option>Option 5</option>
  152 + </select>
  153 + </label>
  154 +
  155 + <label class="block mt-4 text-sm">
  156 + <span class="text-gray-700 dark:text-gray-400">Message</span>
  157 + <textarea
  158 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  159 + rows="3"
  160 + placeholder="Enter some long form content."
  161 + ></textarea>
  162 + </label>
  163 +
  164 + <div class="flex mt-6 text-sm">
  165 + <label class="flex items-center dark:text-gray-400">
  166 + <input
  167 + type="checkbox"
  168 + class="text-purple-600 form-checkbox focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  169 + />
  170 + <span class="ml-2">
  171 + I agree to the
  172 + <span class="underline">privacy policy</span>
  173 + </span>
  174 + </label>
  175 + </div>
  176 +</div>
  177 +
  178 +<!-- Validation inputs -->
  179 + <!--<h4
  180 + class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"
  181 + >
  182 + Validation
  183 + </h4>
  184 + <div
  185 + class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"
  186 + >
  187 + <!-- Invalid input -->
  188 + <!--<label class="block text-sm">
  189 + <span class="text-gray-700 dark:text-gray-400">
  190 + Invalid input
  191 + </span>
  192 + <input
  193 + class="block w-full mt-1 text-sm border-red-600 dark:text-gray-300 dark:bg-gray-700 focus:border-red-400 focus:outline-none focus:shadow-outline-red form-input"
  194 + placeholder="Jane Doe"
  195 + />
  196 + <span class="text-xs text-red-600 dark:text-red-400">
  197 + Your password is too short.
  198 + </span>
  199 + </label>
  200 +
  201 + <!-- Valid input -->
  202 + <!--<label class="block mt-4 text-sm">
  203 + <span class="text-gray-700 dark:text-gray-400">
  204 + Valid input
  205 + </span>
  206 + <input
  207 + class="block w-full mt-1 text-sm border-green-600 dark:text-gray-300 dark:bg-gray-700 focus:border-green-400 focus:outline-none focus:shadow-outline-green form-input"
  208 + placeholder="Jane Doe"
  209 + />
  210 + <span class="text-xs text-green-600 dark:text-green-400">
  211 + Your password is strong.
  212 + </span>
  213 + </label>
  214 +
  215 + <!-- Helper text -->
  216 + <!--<label class="block mt-4 text-sm">
  217 + <span class="text-gray-700 dark:text-gray-400">
  218 + Helper text
  219 + </span>
  220 + <input
  221 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input"
  222 + placeholder="Jane Doe"
  223 + />
  224 + <span class="text-xs text-gray-600 dark:text-gray-400">
  225 + Your password must be at least 6 characters long.
  226 + </span>
  227 + </label>
  228 +</div>
  229 +
  230 +<!-- Inputs with icons -->
  231 + <!--<h4
  232 + class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"
  233 + >
  234 + Icons
  235 + </h4>
  236 + <div
  237 + class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"
  238 + >
  239 + <label class="block text-sm">
  240 + <span class="text-gray-700 dark:text-gray-400">Icon left</span>
  241 + <!-- focus-within sets the color for the icon when input is focused -->
  242 + <!--<div
  243 + class="relative text-gray-500 focus-within:text-purple-600 dark:focus-within:text-purple-400"
  244 + >
  245 + <input
  246 + class="block w-full pl-10 mt-1 text-sm text-black dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input"
  247 + placeholder="Jane Doe"
  248 + />
  249 + <div
  250 + class="absolute inset-y-0 flex items-center ml-3 pointer-events-none"
  251 + >
  252 + <svg
  253 + class="w-5 h-5"
  254 + aria-hidden="true"
  255 + fill="none"
  256 + stroke-linecap="round"
  257 + stroke-linejoin="round"
  258 + stroke-width="2"
  259 + viewBox="0 0 24 24"
  260 + stroke="currentColor"
  261 + >
  262 + <path
  263 + d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
  264 + ></path>
  265 + </svg>
  266 + </div>
  267 + </div>
  268 +</label>
  269 +
  270 +<label class="block mt-4 text-sm">
  271 + <span class="text-gray-700 dark:text-gray-400">Icon right</span>
  272 + <!-- focus-within sets the color for the icon when input is focused -->
  273 + <!--<div
  274 + class="relative text-gray-500 focus-within:text-purple-600 dark:focus-within:text-purple-400"
  275 + >
  276 + <input
  277 + class="block w-full pr-10 mt-1 text-sm text-black dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input"
  278 + placeholder="Jane Doe"
  279 + />
  280 + <div
  281 + class="absolute inset-y-0 right-0 flex items-center mr-3 pointer-events-none"
  282 + >
  283 + <svg
  284 + class="w-5 h-5"
  285 + aria-hidden="true"
  286 + fill="none"
  287 + stroke-linecap="round"
  288 + stroke-linejoin="round"
  289 + stroke-width="2"
  290 + viewBox="0 0 24 24"
  291 + stroke="currentColor"
  292 + >
  293 + <path
  294 + d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
  295 + ></path>
  296 + </svg>
  297 + </div>
  298 + </div>
  299 +</label>
  300 +</div>
  301 +
  302 +<!-- Inputs with buttons -->
  303 + <!--<h4
  304 + class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"
  305 + >
  306 + Buttons
  307 + </h4>
  308 + <div
  309 + class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"
  310 + >
  311 + <label class="block text-sm">
  312 + <span class="text-gray-700 dark:text-gray-400">
  313 + Button left
  314 + </span>
  315 + <div class="relative">
  316 + <input
  317 + class="block w-full pl-20 mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input"
  318 + placeholder="Jane Doe"
  319 + />
  320 + <button
  321 + class="absolute inset-y-0 px-4 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-l-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  322 + >
  323 + Click
  324 + </button>
  325 + </div>
  326 + </label>
  327 +
  328 + <label class="block mt-4 text-sm">
  329 + <span class="text-gray-700 dark:text-gray-400">
  330 + Button right
  331 + </span>
  332 + <div
  333 + class="relative text-gray-500 focus-within:text-purple-600"
  334 + >
  335 + <input
  336 + class="block w-full pr-20 mt-1 text-sm text-black dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input"
  337 + placeholder="Jane Doe"
  338 + />
  339 + <button
  340 + class="absolute inset-y-0 right-0 px-4 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-r-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
  341 + >
  342 + Click
  343 + </button>
  344 + </div>
  345 + </label>
  346 + </div>-->
  347 +@endsection
resources/views/layout/admin.blade.php
... ... @@ -154,7 +154,7 @@
154 154 <li class="relative px-6 py-3">
155 155 <a
156 156 class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
157   - href="{{ route('admin.categories') }}"
  157 + href="{{ route('admin.categories.index') }}"
158 158 >
159 159 <svg
160 160 class="w-5 h-5"
... ... @@ -475,7 +475,7 @@
475 475 <li class="relative px-6 py-3">
476 476 <a
477 477 class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
478   - href="{{ route('admin.categories') }}"
  478 + href="{{ route('admin.categories.index') }}"
479 479 >
480 480 <svg
481 481 class="w-5 h-5"
1 1 <?php
2 2  
3 3 use App\Http\Controllers\Admin\AdminController;
  4 +use App\Http\Controllers\Admin\CategoryController;
4 5 use App\Http\Controllers\Admin\EmployersController;
5 6 use App\Http\Controllers\Admin\UsersController;
6 7 use App\Http\Controllers\Admin\WorkersController;
... ... @@ -93,6 +94,9 @@ Route::group([
93 94  
94 95 // кабинет профиль работодатель - форма
95 96 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
  97 + // кабинет профиль работодатель - сохранение формы
  98 + Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
  99 +
96 100 // кабинет профиль работник - форма
97 101 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile');
98 102  
... ... @@ -117,7 +121,12 @@ Route::group([
117 121 Route::get('ad-employers', [AdminController::class, 'index'])->name('ad-employers');
118 122  
119 123 // кабинет - категории
120   - Route::get('categories', [AdminController::class, 'index'])->name('categories');
  124 + //Route::get('categories', [AdminController::class, 'index'])->name('categories');
  125 + /*
  126 + * CRUD-операции над настройками Компании
  127 + */
  128 + Route::resource('categories', CategoryController::class, ['except' => ['show']]);
  129 +
121 130  
122 131 // кабинет - должности
123 132 Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');