Commit 29350503f1ddb5f83f6fbcb1e3fdc8cd8dcb45b5

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

Расширение полей моделей, группы и категории справочники

Showing 23 changed files with 812 additions and 19 deletions Inline Diff

app/Http/Controllers/Admin/CategoryController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Http\Requests\CategoryRequest; 6 use App\Http\Requests\CategoryRequest;
7 use App\Models\Category; 7 use App\Models\Category;
8 use Illuminate\Http\Request; 8 use Illuminate\Http\Request;
9 use Illuminate\Support\Facades\Auth; 9 use Illuminate\Support\Facades\Auth;
10 use Illuminate\Support\Facades\Storage; 10 use Illuminate\Support\Facades\Storage;
11 11
12 class CategoryController extends Controller 12 class CategoryController extends Controller
13 { 13 {
14 /** 14 /**
15 * Display a listing of the resource. 15 * Display a listing of the resource.
16 * 16 *
17 * @return \Illuminate\Http\Response 17 * @return \Illuminate\Http\Response
18 */ 18 */
19 public function index() 19 public function index()
20 { 20 {
21 $category = Category::query()->paginate(15); 21 $category = Category::query()->active()->paginate(15);
22 return view('admin.category.index', compact('category')); 22 return view('admin.category.index', compact('category'));
23 } 23 }
24 24
25 /** 25 /**
26 * Show the form for creating a new resource. 26 * Show the form for creating a new resource.
27 * 27 *
28 * @return \Illuminate\Http\Response 28 * @return \Illuminate\Http\Response
29 */ 29 */
30 public function create() 30 public function create()
31 { 31 {
32 return view('admin.category.add'); 32 return view('admin.category.add');
33 } 33 }
34 34
35 /** 35 /**
36 * Store a newly created resource in storage. 36 * Store a newly created resource in storage.
37 * 37 *
38 * @param \Illuminate\Http\Request $request 38 * @param \Illuminate\Http\Request $request
39 * @return \Illuminate\Http\Response 39 * @return \Illuminate\Http\Response
40 */ 40 */
41 public function store(CategoryRequest $request) 41 public function store(CategoryRequest $request)
42 { 42 {
43 Category::create($request->all()); 43 Category::create($request->all());
44 return redirect()->route('admin.categories.index'); 44 return redirect()->route('admin.categories.index');
45 } 45 }
46 46
47 /** 47 /**
48 * Display the specified resource. 48 * Display the specified resource.
49 * 49 *
50 * @param \App\Models\Category $category 50 * @param \App\Models\Category $category
51 * @return \Illuminate\Http\Response 51 * @return \Illuminate\Http\Response
52 */ 52 */
53 public function show(Category $category) 53 public function show(Category $category)
54 { 54 {
55 // 55 //
56 } 56 }
57 57
58 /** 58 /**
59 * Show the form for editing the specified resource. 59 * Show the form for editing the specified resource.
60 * 60 *
61 * @param \App\Models\Category $category 61 * @param \App\Models\Category $category
62 * @return \Illuminate\Http\Response 62 * @return \Illuminate\Http\Response
63 */ 63 */
64 public function edit(Category $category) 64 public function edit(Category $category)
65 { 65 {
66 return view('admin.category.edit', compact('category')); 66 return view('admin.category.edit', compact('category'));
67 } 67 }
68 68
69 /** 69 /**
70 * Update the specified resource in storage. 70 * Update the specified resource in storage.
71 * 71 *
72 * @param \Illuminate\Http\Request $request 72 * @param \Illuminate\Http\Request $request
73 * @param \App\Models\Category $category 73 * @param \App\Models\Category $category
74 * @return \Illuminate\Http\Response 74 * @return \Illuminate\Http\Response
75 */ 75 */
76 public function update(CategoryRequest $request, Category $category) 76 public function update(CategoryRequest $request, Category $category)
77 { 77 {
78 $category->update($request->all()); 78 $category->update($request->all());
79 return redirect()->route('admin.categories.index'); 79 return redirect()->route('admin.categories.index');
80 } 80 }
81 81
82 /** 82 /**
83 * Remove the specified resource from storage. 83 * Remove the specified resource from storage.
84 * 84 *
85 * @param \App\Models\Category $category 85 * @param \App\Models\Category $category
86 * @return \Illuminate\Http\Response 86 * @return \Illuminate\Http\Response
87 */ 87 */
88 public function destroy(Category $category) 88 public function destroy(Category $category)
89 { 89 {
90 if (Auth::user()->id == 1) { 90 /*if (Auth::user()->id == 1) {
91 $category->delete(); 91 $category->delete();
92 } 92 } else {*/
93 $category->update(['is_remove' => 1]);
94 //}
93 return redirect()->route('admin.categories.index'); 95 return redirect()->route('admin.categories.index');
94 } 96 }
95 } 97 }
96 98
app/Http/Controllers/Admin/EmployersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\Answer;
6 use App\Models\Employer; 7 use App\Models\Employer;
7 use App\Models\User; 8 use App\Models\User;
8 use Illuminate\Http\Request; 9 use Illuminate\Http\Request;
9 use Illuminate\Support\Facades\Storage; 10 use Illuminate\Support\Facades\Storage;
10 use Illuminate\Support\Facades\Validator; 11 use Illuminate\Support\Facades\Validator;
11 12
12 class EmployersController extends Controller 13 class EmployersController extends Controller
13 { 14 {
14 public function index(Request $request) { 15 public function index(Request $request) {
15 if ($request->ajax()) { 16 if ($request->ajax()) {
16 $user = User::find($request->id); 17 $user = User::find($request->id);
17 $request->offsetUnset('id'); 18 $request->offsetUnset('id');
18 $user->update($request->all()); 19 $user->update($request->all());
19 } 20 }
20 21
21 $users = User::where('is_worker', '0')->paginate(15); 22 $users = User::where('is_worker', '0')->paginate(15);
22 if ($request->ajax()) { 23 if ($request->ajax()) {
23 return view('admin.employer.index_ajax', compact('users')); 24 return view('admin.employer.index_ajax', compact('users'));
24 } else { 25 } else {
25 return view('admin.employer.index', compact('users')); 26 return view('admin.employer.index', compact('users'));
26 } 27 }
27 } 28 }
28 29
29 public function form_update_employer(Employer $employer) { 30 public function form_update_employer(Employer $employer) {
30 return view('admin.employer.edit', compact('employer')); 31 return view('admin.employer.edit', compact('employer'));
31 } 32 }
32 33
33 public function update_employer(Employer $employer, Request $request) 34 public function update_employer(Employer $employer, Request $request)
34 { 35 {
35 $params = $request->all(); 36 $params = $request->all();
36 unset($params['logo']); 37 unset($params['logo']);
37 unset($params['telephone']); 38 unset($params['telephone']);
38 unset($params['email']); 39 unset($params['email']);
39 unset($params['address']); 40 unset($params['address']);
40 unset($params['site']); 41 unset($params['site']);
41 42
42 $rules = [ 43 $rules = [
43 'name' => 'required|string|max:255', 44 'name' => 'required|string|max:255',
44 ]; 45 ];
45 46
46 $messages = [ 47 $messages = [
47 'required' => 'Укажите обязательное поле «:attribute»', 48 'required' => 'Укажите обязательное поле «:attribute»',
48 'confirmed' => 'Пароли не совпадают', 49 'confirmed' => 'Пароли не совпадают',
49 'email' => 'Введите корректный email', 50 'email' => 'Введите корректный email',
50 'min' => [ 51 'min' => [
51 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 52 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
52 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 53 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
53 ], 54 ],
54 'max' => [ 55 'max' => [
55 'string' => 'Поле «:attribute» должно быть не больше :max символов', 56 'string' => 'Поле «:attribute» должно быть не больше :max символов',
56 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 57 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
57 ], 58 ],
58 ]; 59 ];
59 60
60 $validator = Validator::make($params, $rules, $messages); 61 $validator = Validator::make($params, $rules, $messages);
61 62
62 if ($validator->fails()) { 63 if ($validator->fails()) {
63 return back()->withErrors($validator)->withInput(); //->route('admin.register') 64 return back()->withErrors($validator)->withInput(); //->route('admin.register')
64 65
65 } else { 66 } else {
66 67
67 //$user = User::find($employer->user_id); 68 //$user = User::find($employer->user_id);
68 $user_id = $employer->user_id; 69 $user_id = $employer->user_id;
69 $employer->telephone = $request->telephone; 70 $employer->telephone = $request->telephone;
70 $employer->email = $request->email; 71 $employer->email = $request->email;
71 $employer->address = $request->address; 72 $employer->address = $request->address;
72 $employer->site = $request->site; 73 $employer->site = $request->site;
73 $employer->text = $request->text; 74 $employer->text = $request->text;
74 75
75 if ($request->has('logo')) { 76 if ($request->has('logo')) {
76 if (!empty($employer->logo)) { 77 if (!empty($employer->logo)) {
77 Storage::delete($employer->logo); 78 Storage::delete($employer->logo);
78 } 79 }
79 $employer->logo = $request->file('logo')->store("employer/$user_id", 'public'); 80 $employer->logo = $request->file('logo')->store("employer/$user_id", 'public');
80 } 81 }
81 $employer->save(); 82 $employer->save();
82 83
83 $user = User::find($user_id); 84 $user = User::find($user_id);
84 $user->update($params); 85 $user->update($params);
85 86
86 return redirect()->route('admin.employer-profile', ['employer' => $employer->id]) 87 return redirect()->route('admin.employer-profile', ['employer' => $employer->id])
87 ->with('success', 'Данные были успешно сохранены'); 88 ->with('success', 'Данные были успешно сохранены');
88 } 89 }
89 } 90 }
90 91
91 // кабинет - отзывы о работодателе для модерации 92 // кабинет - отзывы о работодателе для модерации
92 public function answers() { 93 public function answers(Request $request) {
93 return; 94 if ($request->ajax()) {
95 $user = Answer::find($request->id);
96 $request->offsetUnset('id');
97 $user->update($request->all());
98 }
99
100 $answers = Answer::query()->orderByDesc('id')->paginate(15);
101
102 if ($request->ajax()) {
103 return view('admin.answers.index_ajax', compact('answers'));
104 } else {
105 return view('admin.answers.index', compact('answers'));
106 }
94 } 107 }
95 108
96 // кабинет - статистика вакансий работодателя 109 // кабинет - статистика вакансий работодателя
97 public function static_ads() { 110 public function static_ads() {
98 return; 111 return;
99 } 112 }
100 113
101 114
102 } 115 }
103 116
app/Http/Controllers/Admin/GroupsController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\Group_user; 6 use App\Models\Group_user;
7 use App\Models\User;
7 use Illuminate\Http\Request; 8 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Auth; 9 use Illuminate\Support\Facades\Auth;
9 use Illuminate\Support\Facades\Validator; 10 use Illuminate\Support\Facades\Validator;
10 11
11 class GroupsController extends Controller 12 class GroupsController extends Controller
12 { 13 {
13 // индексная страница 14 // индексная страница
14 public function index() { 15 public function index() {
15 $groups = Group_user::query()->paginate(15); 16 $groups = Group_user::query()->active()->paginate(15);
16 return view('admin.groups.index', compact('groups')); 17 return view('admin.groups.index', compact('groups'));
17 } 18 }
18 19
19 // форма добавления группы 20 // форма добавления группы
20 public function add() { 21 public function add() {
21 $editor = Auth::user()->id; 22 $editor = Auth::user()->id;
22 return view('admin.groups.add', compact('editor')); 23 $users = User::query()->get();
24 return view('admin.groups.add', compact('editor', 'users'));
23 } 25 }
24 26
25 // форма сохранения добавленной группы 27 // форма сохранения добавленной группы
26 public function store(Request $request) { 28 public function store(Request $request) {
27 $rules = [ 29 $rules = [
28 'name_group' => 'required|min:3', 30 'name_group' => 'required|min:3',
29 ]; 31 ];
30 $messages = [ 32 $messages = [
31 'required' => 'Укажите обязательное поле', 33 'required' => 'Укажите обязательное поле',
32 ]; 34 ];
33 $validator = Validator::make($request->all(), $rules, $messages); 35 $validator = Validator::make($request->all(), $rules, $messages);
34 36
35 if ($validator->fails()) { 37 if ($validator->fails()) {
36 return redirect()->route('admin.add-group') 38 return redirect()->route('admin.add-group')
37 ->withErrors($validator); 39 ->withErrors($validator);
38 } else { 40 } else {
39 Group_user::create($request->all()); 41 Group_user::create($request->all());
40 return redirect()->route('admin.groups') 42 return redirect()->route('admin.groups')
41 ->with('success', 'Данные были успешно сохранены'); 43 ->with('success', 'Данные были успешно сохранены');
42 } 44 }
43 return redirect()->route('admin.groups'); 45 return redirect()->route('admin.groups');
44 } 46 }
45 47
46 // форма редактирования группы 48 // форма редактирования группы
47 public function edit(Group_user $group, Request $request) { 49 public function edit(Group_user $group, Request $request) {
48 $editor = Auth::user()->id; 50 $editor = Auth::user()->id;
49 return view('admin.groups.edit', compact('editor', 'group')); 51 $users = User::query()->get();
52 return view('admin.groups.edit', compact('editor', 'group', 'users'));
50 } 53 }
51 54
52 // форма сохранения редактированной группы 55 // форма сохранения редактированной группы
53 public function update(Group_user $group, Request $request) { 56 public function update(Group_user $group, Request $request) {
57
58 $params = $request->all();
59 unset($params['usergroup']);
54 $rules = [ 60 $rules = [
55 'name_group' => 'required|min:3', 61 'name_group' => 'required|min:3',
56 ]; 62 ];
57 $messages = [ 63 $messages = [
58 'required' => 'Укажите обязательное поле', 64 'required' => 'Укажите обязательное поле',
59 ]; 65 ];
60 $validator = Validator::make($request->all(), $rules, $messages); 66 $validator = Validator::make($request->all(), $rules, $messages);
61 67
62 if ($validator->fails()) { 68 if ($validator->fails()) {
63 return redirect()->route('admin.edit-group', ['group' => $group->id]) 69 return redirect()->route('admin.edit-group', ['group' => $group->id])
64 ->withErrors($validator); 70 ->withErrors($validator);
65 } else { 71 } else {
66 $group->update($request->all()); 72 $group->update($request->all());
73 $group->ingroup()->sync($request->usergroup);
74 /*if ($request->usergroup->count()) {
75 foreach ($request->usergroup as $us) {
76 Group_works
77 }
78 }*/
79
67 return redirect()->route('admin.groups') 80 return redirect()->route('admin.groups')
68 ->with('success', 'Данные были успешно сохранены'); 81 ->with('success', 'Данные были успешно сохранены');
69 } 82 }
70 return redirect()->route('admin.groups'); 83 return redirect()->route('admin.groups');
71 } 84 }
85
86 public function destroy(Group_user $group) {
87 $group->update(['is_remove' => 1]);
88
89 return redirect()->route('admin.groups');
90 }
72 } 91 }
73 92
app/Http/Controllers/Admin/UsersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\User; 6 use App\Models\User;
7 use Illuminate\Http\Request; 7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Auth; 8 use Illuminate\Support\Facades\Auth;
9 9
10 class UsersController extends Controller 10 class UsersController extends Controller
11 { 11 {
12 public function index(Request $request) { 12 public function index(Request $request) {
13 $title = 'Админка - Пользователи системы'; 13 $title = 'Админка - Пользователи системы';
14 $id_admin = Auth::user()->id; 14 $id_admin = Auth::user()->id;
15 if ($request->ajax()) { 15 if ($request->ajax()) {
16 $user = User::find($request->id); 16 $user = User::find($request->id);
17 $request->offsetUnset('id'); 17 $request->offsetUnset('id');
18 $user->update($request->all()); 18 $user->update($request->all());
19 } 19 }
20 20
21 $users = User::query()->paginate(15); 21 $users = User::query()->paginate(15);
22 22
23 if ($request->ajax()) { 23 if ($request->ajax()) {
24 return view('admin.users.index_ajax', compact('users', 'id_admin')); 24 return view('admin.users.index_ajax', compact('users', 'id_admin'));
25 } else { 25 } else {
26 return view('admin.users.index', compact('users', 'title', 'id_admin')); 26 return view('admin.users.index', compact('users', 'title', 'id_admin'));
27 } 27 }
28 } 28 }
29 29
30 public function roles() { 30 public function roles(Request $request) {
31 return; 31 if ($request->ajax()) {
32 $user = User::find($request->id);
33 $request->offsetUnset('id');
34 $user->update($request->all());
35 }
36
37 $users = User::query()->paginate(15);
38
39 if ($request->ajax()) {
40 return view('admin.users.roles.index_ajax', compact('users'));
41 } else {
42 return view('admin.users.roles.index', compact('users'));
43 }
32 } 44 }
33 } 45 }
34 46
app/Models/Ad_employer.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Ad_employer extends Model 8 class Ad_employer extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [
13 'name',
14 'telephone',
15 'email',
16 'salary',
17 'category_id',
18 'text',
19 'employer_id',
20 'city',
21 'sort',
22 'is_remove',
23 'active_is',
24 ];
12 /* 25 /*
13 * Связь таблицы employers с таблицей ad_employers 26 * Связь таблицы employers с таблицей ad_employers
14 многие-к-одному 27 многие-к-одному
15 */ 28 */
16 public function employer() { 29 public function employer() {
17 return $this->belongsTo(Employer::class, 'employer_id'); 30 return $this->belongsTo(Employer::class, 'employer_id');
18 } 31 }
19 32
20 /* 33 /*
21 * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title) 34 * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title)
22 многие-ко-многим 35 многие-ко-многим
23 */ 36 */
24 public function jobs() { 37 public function jobs() {
25 return $this->belongsToMany(Job_title::class, 'ad_jobs'); 38 return $this->belongsToMany(Job_title::class, 'ad_jobs');
26 } 39 }
27 40
28 /* 41 /*
29 * Связь модели Вакансия (Ad_employers) с моделью Отклик на Вакансию (Ad_response) 42 * Связь модели Вакансия (Ad_employers) с моделью Отклик на Вакансию (Ad_response)
30 один-ко-многим 43 один-ко-многим
31 */ 44 */
32 public function response() { 45 public function response() {
33 return $this->hasMany(ad_response::class); 46 return $this->hasMany(ad_response::class);
34 } 47 }
48
49 public function scopeActive($query) {
50 return $query->where('is_remove', '=', '0');
51 }
35 } 52 }
36 53
app/Models/Answer.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Answer extends Model 8 class Answer extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11
12 protected $fillable = [
13 'employer_id',
14 'user_id',
15 'plus',
16 'minus',
17 'rate',
18 'title',
19 'text',
20 'is_moderate',
21 ];
22
23 /*
24 * Связь таблицы employers с таблицей answers
25 многие-к-одному
26 */
27 public function employer() {
28 return $this->belongsTo(Employer::class, 'employer_id');
29 }
30
31 /*
32 * Связь таблицы users с таблицей answers
33 многие-к-одному
34 */
35 public function user() {
36 return $this->belongsTo(User::class, 'user_id');
37 }
38
11 } 39 }
12 40
app/Models/Category.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Category extends Model 8 class Category extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [ 12 protected $fillable = [
13 'name', 13 'name',
14 'is_remove'
14 ]; 15 ];
16
17 public function scopeActive($query) {
18 return $query->where('is_remove', '=', '0');
19 }
15 } 20 }
16 21
app/Models/Employer.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Employer extends Model 8 class Employer extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [ 12 protected $fillable = [
13 'name_company', 13 'name_company',
14 'email', 14 'email',
15 'telephone', 15 'telephone',
16 'logo', 16 'logo',
17 'rate', 17 'rate',
18 'user_id', 18 'user_id',
19 'sort', 19 'sort',
20 'text', 20 'text',
21 'address', 21 'address',
22 'map', 22 'map',
23 'site', 23 'site',
24 'coord',
25 'plus',
26 'is_remove',
27 'oficial_status',
28 'social_is',
29 'sending_is',
24 ]; 30 ];
25 31
26 /* 32 /*
27 * Связь таблицы users с таблицей employers 33 * Связь таблицы users с таблицей employers
28 */ 34 */
29 public function users() { 35 public function users() {
30 return $this->belongsTo(User::class, 'user_id'); 36 return $this->belongsTo(User::class, 'user_id');
31 } 37 }
32 38
33 /* 39 /*
34 * Связь Работодателя с вакансиями 40 * Связь Работодателя с вакансиями
35 */ 41 */
36 public function ads() { 42 public function ads() {
37 return $this->hasMany(Ad_employer::class); 43 return $this->hasMany(Ad_employer::class);
38 } 44 }
39 45
46 public function scopeActive($query) {
47 return $query->where('is_remove', '=', '0');
48 }
40 49
41 } 50 }
42 51
app/Models/Group_user.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Group_user extends Model 8 class Group_user extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [ 12 protected $fillable = [
13 'name_group', 13 'name_group',
14 'user_id', 14 'user_id',
15 'is_remove',
15 ]; 16 ];
16 17
17 /* 18 /*
18 * Связь Модели Группы (Group_user) с Модели Юзеры (User) 19 * Связь Модели Группы (Group_user) с Модели Юзеры (User)
19 многие-к-одному 20 многие-к-одному
20 */ 21 */
21 public function user() { 22 public function user() {
22 return $this->belongsTo(User::class, 'user_id'); 23 return $this->belongsTo(User::class, 'user_id');
23 } 24 }
24 25
25 /* 26 /*
26 * Связь модели Группы (Group_user) с Моделью Юзеры (User) - участники группы 27 * Связь модели Группы (Group_user) с Моделью Юзеры (User) - участники группы
27 многие-ко-многим 28 многие-ко-многим
28 */ 29 */
29 public function ingroup() { 30 public function ingroup() {
30 return $this->belongsToMany(User::class, 'group_works'); 31 return $this->belongsToMany(User::class, 'group_works');
31 } 32 }
32 33
34 /*
35 * Связь модели Группы (Group_users) с моделью Группы пользователей (Group_works)
36 один-ко-многим
37 */
38 public function peoples() {
39 return $this->hasMany(Group_works::class);
40 }
41
42 public function scopeActive($query) {
43 return $query->where('is_remove', '=', '0');
44 }
45
33 } 46 }
34 47
app/Models/Group_works.php
File was created 1 <?php
2
3 namespace App\Models;
4
5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model;
7
8 class Group_works extends Model
9 {
10 use HasFactory;
11
12 protected $table = 'group_works';
13
14 protected $fillable = [
15 'group_user_id',
16 'user_id',
17 ];
18
19 /*
20 * Связь Модели Группы (Group_user) с Модели Юзеры (User)
21 многие-к-одному
22 */
23 public function user() {
24 return $this->belongsTo(User::class, 'user_id');
25 }
26
27 /*
28 * Связь Модели Группы (Group_user) с Модели Юзеры (User)
29 многие-к-одному
30 */
31 public function group() {
32 return $this->belongsTo(Group_user::class, 'group_user_id');
33 }
34
35 }
36
app/Models/Job_title.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Job_title extends Model 8 class Job_title extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [
13 'name',
14 'is_remove',
15 'parent_id',
16 ];
12 /* 17 /*
13 * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title) 18 * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title)
14 */ 19 */
15 public function Ads() { 20 public function Ads() {
16 return $this->belongsToMany(Ad_employer::class, 'ad_jobs'); 21 return $this->belongsToMany(Ad_employer::class, 'ad_jobs');
17 } 22 }
23
24 public function scopeActive($query) {
25 return $query->where('is_remove', '=', '0');
26 }
18 } 27 }
19 28
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 // use Illuminate\Contracts\Auth\MustVerifyEmail; 5 // use Illuminate\Contracts\Auth\MustVerifyEmail;
6 use Illuminate\Database\Eloquent\Factories\HasFactory; 6 use Illuminate\Database\Eloquent\Factories\HasFactory;
7 use Illuminate\Foundation\Auth\User as Authenticatable; 7 use Illuminate\Foundation\Auth\User as Authenticatable;
8 use Illuminate\Notifications\Notifiable; 8 use Illuminate\Notifications\Notifiable;
9 use Laravel\Sanctum\HasApiTokens; 9 use Laravel\Sanctum\HasApiTokens;
10 10
11 class User extends Authenticatable 11 class User extends Authenticatable
12 { 12 {
13 use HasApiTokens, HasFactory, Notifiable; 13 use HasApiTokens, HasFactory, Notifiable;
14 14
15 /** 15 /**
16 * The attributes that are mass assignable. 16 * The attributes that are mass assignable.
17 * 17 *
18 * @var array<int, string> 18 * @var array<int, string>
19 */ 19 */
20 protected $fillable = [ 20 protected $fillable = [
21 'name', 21 'name',
22 'email', 22 'email',
23 'password', 23 'password',
24 'admin', 24 'admin',
25 'telephone', 25 'telephone',
26 'surname', 26 'surname',
27 'name_man', 27 'name_man',
28 'surname2', 28 'surname2',
29 'is_worker', 29 'is_worker',
30 'is_lookin', 30 'is_lookin',
31 'is_message', 31 'is_message',
32 'is_public', 32 'is_public',
33 'is_remove', 33 'is_remove',
34 'is_ban', 34 'is_ban',
35 'is_new', 35 'is_new',
36 ]; 36 ];
37 37
38 /** 38 /**
39 * The attributes that should be hidden for serialization. 39 * The attributes that should be hidden for serialization.
40 * 40 *
41 * @var array<int, string> 41 * @var array<int, string>
42 */ 42 */
43 protected $hidden = [ 43 protected $hidden = [
44 'password', 44 'password',
45 'remember_token', 45 'remember_token',
46 ]; 46 ];
47 47
48 /** 48 /**
49 * The attributes that should be cast. 49 * The attributes that should be cast.
50 * 50 *
51 * @var array<string, string> 51 * @var array<string, string>
52 */ 52 */
53 protected $casts = [ 53 protected $casts = [
54 'email_verified_at' => 'datetime', 54 'email_verified_at' => 'datetime',
55 ]; 55 ];
56 56
57 /* 57 /*
58 * Связь Пользователей системы с работодателями 58 * Связь Пользователей системы с работодателями
59 * users - employers 59 * users - employers
60 */ 60 */
61 public function employers() { 61 public function employers() {
62 return $this->hasMany(Employer::class, 'user_id'); 62 return $this->hasMany(Employer::class, 'user_id');
63 } 63 }
64 64
65 /* 65 /*
66 * Связь Пользователей системы с работниками 66 * Связь Пользователей системы с работниками
67 * users - workers 67 * users - workers
68 */ 68 */
69 public function workers() { 69 public function workers() {
70 return $this->hasMany(Worker::class, 'user_id'); 70 return $this->hasMany(Worker::class, 'user_id');
71 } 71 }
72 72
73 /* 73 /*
74 * Связь Пользователей системы с группами юзеров 74 * Связь Модели Пользователей(Users) с Группами (Group_users)
75 * users - group_users 75 * users - group_users
76 */ 76 многие-ко-многим
77 public function groups() { 77 */
78 return $this->hasMany(Group_user::class); 78 public function ingroup() {
79 return $this->belongsToMany(Group_user::class, 'group_works');
79 } 80 }
80 81
81 /* 82 /*
82 * Связь Пользователей системы с ссобщениями 83 * Связь Пользователей системы с ссобщениями
83 * users - messages 84 * users - messages
84 */ 85 */
85 public function messages() { 86 public function messages() {
86 return $this->hasMany(Message::class); 87 return $this->hasMany(Message::class);
87 } 88 }
88 89
89 /* 90 /*
90 * Связь Пользователей системы с статистика 91 * Связь Пользователей системы с статистика
91 * users - static_workers 92 * users - static_workers
92 */ 93 */
93 public function static_user() { 94 public function static_user() {
94 return $this->hasMany(Static_worker::class); 95 return $this->hasMany(Static_worker::class);
95 } 96 }
96 97
98 /*
99 * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works)
100 один-ко-многим
101 */
102 public function peoples() {
103 return $this->hasMany(Group_works::class);
104 }
105
106 public function scopeActive($query) {
107 return $query->where('is_remove', '=', '0');
108 }
97 109
98 } 110 }
99 111
app/Models/Worker.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Worker extends Model 8 class Worker extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [ 12 protected $fillable = [
13 'user_id', 13 'user_id',
14 'status_work', 14 'status_work',
15 'position_work', 15 'position_work',
16 'telephone', 16 'telephone',
17 'telephone2', 17 'telephone2',
18 'persent_anketa', 18 'persent_anketa',
19 'photo', 19 'photo',
20 'email_data', 20 'email_data',
21 'status_profile', 21 'status_profile',
22 'old_year', 22 'old_year',
23 'experience', 23 'experience',
24 'en_is', 24 'en_is',
25 'education', 25 'education',
26 'email', 26 'email',
27 'interpassport', 27 'interpassport',
28 'mk', 28 'mk',
29 'vvp', 29 'vvp',
30 'vlm', 30 'vlm',
31 'reka_diplom', 31 'reka_diplom',
32 'more_diplom', 32 'more_diplom',
33 'mpss', 33 'mpss',
34 'tanker', 34 'tanker',
35 'gmssb', 35 'gmssb',
36 'resume', 36 'resume',
37 'sort', 37 'sort',
38 'updated_at', 38 'updated_at',
39 'text', 39 'text',
40 'address', 40 'address',
41 'city', 41 'city',
42 'coord',
43 'file',
44 'is_remove',
42 ]; 45 ];
43 46
44 /* 47 /*
45 * Связь таблицы users с таблицей workers 48 * Связь таблицы users с таблицей workers
46 */ 49 */
47 public function users() { 50 public function users() {
48 return $this->belongsTo(User::class, 'user_id'); 51 return $this->belongsTo(User::class, 'user_id');
49 } 52 }
53
54 public function scopeActive($query) {
55 return $query->where('is_remove', '=', '0');
56 }
50 } 57 }
51 58
database/migrations/2023_09_07_134401_alter_group_users_table.php
File was created 1 <?php
2
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
6
7 return new class extends Migration
8 {
9 /**
10 * Run the migrations.
11 *
12 * @return void
13 */
14 public function up()
15 {
16 Schema::table('group_users', function (Blueprint $table) {
17 $table->boolean('is_remove')->default(false);
18 });
19 }
20
21 /**
22 * Reverse the migrations.
23 *
24 * @return void
25 */
26 public function down()
27 {
28 Schema::table('group_users', function (Blueprint $table) {
29 $table->dropColumn('is_remove');
30 });
31 }
32 };
33
resources/views/admin/answers/index.blade.php
File was created 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 var str ="id=" + value + "&is_moderate=" + bool;
18 console.log(str);
19 $.ajax({
20 type: "GET",
21 url: "{{ url()->full()}}",
22 data: str,
23 success: function (data) {
24 console.log('Обновление таблицы пользователей ');
25 //data = JSON.parse(data);
26 //console.log(data);
27 ajax_block.html(data);
28 },
29 headers: {
30 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
31 },
32 error: function (data) {
33 console.log('Error: ' + data);
34 }
35 });
36 });
37
38 });
39 </script>
40 @endsection
41
42 @section('search')
43 <!--<div class="absolute inset-y-0 flex items-center pl-2">
44 <svg
45 class="w-4 h-4"
46 aria-hidden="true"
47 fill="currentColor"
48 viewBox="0 0 20 20"
49 >
50 <path
51 fill-rule="evenodd"
52 d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
53 clip-rule="evenodd"
54 ></path>
55 </svg>
56 </div>
57 <form action="" method="POST">
58 <div style="float:left;"><input
59 class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
60 style="width: 400px"
61 type="text"
62 placeholder="Искать..."
63 aria-label="Search"
64 /></div>
65 <div style="float: left">
66 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
67 </div>
68 </form>-->
69 @endsection
70
71 @section('content')
72 <style>
73 .col {
74 width: 250px; /* Ширина блока */
75 word-wrap: break-word; /* Перенос слов */
76 word-break: break-all;
77 }
78 </style>
79 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
80 <div class="w-full overflow-x-auto">
81 <table class="w-full whitespace-no-wrap">
82 <thead>
83 <tr
84 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"
85 >
86 <th class="px-4 py-3">№</th>
87 <th class="px-4 py-3">Название компании</th>
88 <th class="px-4 py-3">Комментатор</th>
89 <th class="px-4 py-3">Заголовок/Текст</th>
90 <th class="px-4 py-3">Дата коммента</th>
91 <th class="px-4 py-3">Разрешить</th>
92 </tr>
93 </thead>
94 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
95 @foreach($answers as $answer)
96 <tr class="text-gray-700 dark:text-gray-400">
97 <td class="px-4 py-3">
98 {{$answer->id}}
99 </td>
100 <td class="px-4 py-3">
101 {{$answer->employer->name_company}}
102 </td>
103 <td class="px-4 py-3">
104 {{$answer->user->name}}
105 </td>
106 <td class="px-4 py-3 col" >
107 <!--<div class="flex items-center text-sm">
108 <div >-->
109 <p class="font-semibold">{{$answer->title}}</p>
110 <textarea style="width:250px; height: 100px;" readonly="readonly" class="text-xs text-gray-600 dark:text-gray-400">{{ $answer->text }}</textarea>
111 <!--</div>
112 </div>-->
113 </td>
114 <td class="px-4 py-3 text-sm">
115 {{ $answer->created_at }}
116 </td>
117 <td class="px-4 py-3 text-sm">
118 <input type="checkbox" class="checkban" value="{{$answer->id}}" name="moderate_{{$answer->id}}" {{ ($answer->is_moderate) ? "checked" : "" }}/>
119 </td>
120 </tr>
121 @endforeach
122 </tbody>
123 </table>
124 </div>
125
126 <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">
127 <?=$answers->appends($_GET)->links('admin.pagginate'); ?>
128 </div>
129 </div>
130 @endsection
131
resources/views/admin/answers/index_ajax.blade.php
File was created 1 <div class="w-full overflow-x-auto">
2 <table class="w-full whitespace-no-wrap">
3 <thead>
4 <tr
5 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"
6 >
7 <th class="px-4 py-3">№</th>
8 <th class="px-4 py-3">Название компании</th>
9 <th class="px-4 py-3">Комментатор</th>
10 <th class="px-4 py-3">Заголовок/Текст</th>
11 <th class="px-4 py-3">Дата коммента</th>
12 <th class="px-4 py-3">Разрешить</th>
13 </tr>
14 </thead>
15 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
16 @foreach($answers as $answer)
17 <tr class="text-gray-700 dark:text-gray-400">
18 <td class="px-4 py-3">
19 {{$answer->id}}
20 </td>
21 <td class="px-4 py-3">
22 {{$answer->employer->name_company}}
23 </td>
24 <td class="px-4 py-3">
25 {{$answer->user->name}}
26 </td>
27 <td class="px-4 py-3 col" >
28 <!--<div class="flex items-center text-sm">
29 <div >-->
30 <p class="font-semibold">{{$answer->title}}</p>
31 <textarea style="width:250px; height: 100px;" readonly="readonly" class="text-xs text-gray-600 dark:text-gray-400">{{ $answer->text }}</textarea>
32 <!--</div>
33 </div>-->
34 </td>
35 <td class="px-4 py-3 text-sm">
36 {{ $answer->created_at }}
37 </td>
38 <td class="px-4 py-3 text-sm">
39 <input type="checkbox" class="checkban" value="{{$answer->id}}" name="moderate_{{$answer->id}}" {{ ($answer->is_moderate) ? "checked" : "" }}/>
40 </td>
41 </tr>
42 @endforeach
43 </tbody>
44 </table>
45 </div>
46
47 <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">
48 <?=$answers->appends($_GET)->links('admin.pagginate'); ?>
49 </div>
50
resources/views/admin/category/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Категории']) 1 @extends('layout.admin', ['title' => 'Админка - Категории'])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.checkban', function () { 6 $(document).on('click', '.checkban', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var ajax_block = $('#ajax_block'); 9 var ajax_block = $('#ajax_block');
10 var bool = 0; 10 var bool = 0;
11 11
12 if(this.checked){ 12 if(this.checked){
13 bool = 1; 13 bool = 1;
14 } else { 14 } else {
15 bool = 0; 15 bool = 0;
16 } 16 }
17 17
18 $.ajax({ 18 $.ajax({
19 type: "GET", 19 type: "GET",
20 url: "{{ url()->full()}}", 20 url: "{{ url()->full()}}",
21 data: "id=" + value + "&is_ban=" + bool, 21 data: "id=" + value + "&is_ban=" + bool,
22 success: function (data) { 22 success: function (data) {
23 console.log('Обновление таблицы пользователей '); 23 console.log('Обновление таблицы пользователей ');
24 //data = JSON.parse(data); 24 //data = JSON.parse(data);
25 console.log(data); 25 console.log(data);
26 ajax_block.html(data); 26 ajax_block.html(data);
27 }, 27 },
28 headers: { 28 headers: {
29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
30 }, 30 },
31 error: function (data) { 31 error: function (data) {
32 console.log('Error: ' + data); 32 console.log('Error: ' + data);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 36
37 }); 37 });
38 </script> 38 </script>
39 @endsection 39 @endsection
40 40
41 @section('search') 41 @section('search')
42 <div class="absolute inset-y-0 flex items-center pl-2"> 42 <div class="absolute inset-y-0 flex items-center pl-2">
43 <svg 43 <svg
44 class="w-4 h-4" 44 class="w-4 h-4"
45 aria-hidden="true" 45 aria-hidden="true"
46 fill="currentColor" 46 fill="currentColor"
47 viewBox="0 0 20 20" 47 viewBox="0 0 20 20"
48 > 48 >
49 <path 49 <path
50 fill-rule="evenodd" 50 fill-rule="evenodd"
51 d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" 51 d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
52 clip-rule="evenodd" 52 clip-rule="evenodd"
53 ></path> 53 ></path>
54 </svg> 54 </svg>
55 </div> 55 </div>
56 <form action="" method="POST"> 56 <form action="" method="POST">
57 <div style="float:left;"><input 57 <div style="float:left;"><input
58 class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input" 58 class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
59 style="width: 400px" 59 style="width: 400px"
60 type="text" 60 type="text"
61 placeholder="Искать..." 61 placeholder="Искать..."
62 aria-label="Search" 62 aria-label="Search"
63 /></div> 63 /></div>
64 <div style="float: left"> 64 <div style="float: left">
65 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> 65 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
66 </div> 66 </div>
67 </form> 67 </form>
68 @endsection 68 @endsection
69 69
70 @section('content') 70 @section('content')
71 71
72 <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"> 72 <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">
73 Добавить категорию 73 Добавить категорию
74 </a> 74 </a>
75 <br> 75 <br>
76 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 76 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
77 77
78 <div class="w-full overflow-x-auto"> 78 <div class="w-full overflow-x-auto">
79 <table class="w-full whitespace-no-wrap"> 79 <table class="w-full whitespace-no-wrap">
80 <thead> 80 <thead>
81 <tr 81 <tr
82 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" 82 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"
83 > 83 >
84 <th class="px-4 py-3">№</th> 84 <th class="px-4 py-3">№</th>
85 <th class="px-4 py-3">Название категории</th> 85 <th class="px-4 py-3">Название категории</th>
86 <th class="px-4 py-3">Дата создания</th> 86 <th class="px-4 py-3">Дата создания</th>
87 <th class="px-4 py-3">Редактировать</th> 87 <th class="px-4 py-3">Редактировать</th>
88 </tr> 88 </tr>
89 </thead> 89 </thead>
90 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 90 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
91 @foreach($category as $cat) 91 @foreach($category as $cat)
92 <tr class="text-gray-700 dark:text-gray-400"> 92 <tr class="text-gray-700 dark:text-gray-400">
93 <td class="px-4 py-3"> 93 <td class="px-4 py-3">
94 {{$cat->id}} 94 {{$cat->id}}
95 </td> 95 </td>
96 <td class="px-4 py-3"> 96 <td class="px-4 py-3">
97 {{$cat->name}} 97 {{$cat->name}}
98 </td> 98 </td>
99 <td class="px-4 py-3"> 99 <td class="px-4 py-3">
100 {{$cat->created_at}} 100 {{$cat->created_at}}
101 </td> 101 </td>
102 <td class="px-4 py-3 text-sm"> 102 <td class="px-4 py-3 text-sm_">
103 <form action="{{ route('admin.categories.destroy', ['category' => $cat->id]) }}" method="POST"> 103 <form action="{{ route('admin.categories.destroy', ['category' => $cat->id]) }}" method="POST">
104 <a href="{{ route('admin.categories.edit', ['category' => $cat->id]) }}">Изменить</a> | 104 <a href="{{ route('admin.categories.edit', ['category' => $cat->id]) }}">Изменить</a> |
105 @csrf 105 @csrf
106 @method('DELETE') 106 @method('DELETE')
107 <input class=" btn-danger" type="submit" value="Удалить"> 107 <input class="btn btn-danger" type="submit" value="Удалить"/>
108 </form> 108 </form>
109 </td> 109 </td>
110 </tr> 110 </tr>
111 @endforeach 111 @endforeach
112 </tbody> 112 </tbody>
113 </table> 113 </table>
114 </div> 114 </div>
115 115
116 <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"> 116 <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">
117 <?=$category->appends($_GET)->links('admin.pagginate'); ?> 117 <?=$category->appends($_GET)->links('admin.pagginate'); ?>
118 </div> 118 </div>
119 </div> 119 </div>
120 @endsection 120 @endsection
121 121
resources/views/admin/groups/form.blade.php
1 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 1 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
2 <label class="block text-sm"> 2 <label class="block text-sm">
3 <span class="text-gray-700 dark:text-gray-400">Имя группы</span> 3 <span class="text-gray-700 dark:text-gray-400">Имя группы</span>
4 <input name="name_group" id="name_group" 4 <input name="name_group" id="name_group"
5 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" 5 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"
6 placeholder="Название группы" value="{{ old('name_group') ?? $group->name_group ?? '' }}" 6 placeholder="Название группы" value="{{ old('name_group') ?? $group->name_group ?? '' }}"
7 /> 7 />
8 @error('name_group') 8 @error('name_group')
9 <span class="text-xs text-red-600 dark:text-red-400"> 9 <span class="text-xs text-red-600 dark:text-red-400">
10 {{ $message }} 10 {{ $message }}
11 </span> 11 </span>
12 @enderror 12 @enderror
13 </label><br> 13 </label><br>
14
15 <input type="hidden" name="user_id" id="user_id" value="{{ $editor }}"/> 14 <input type="hidden" name="user_id" id="user_id" value="{{ $editor }}"/>
16 15
17 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 16 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
18 <div> 17 <div>
19 <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"> 18 <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">
20 Сохранить 19 Сохранить
21 </button> 20 </button>
22 </div> 21 </div>
23 </div> 22 </div>
23
24 <label class="block text-sm">
25 <span class="text-gray-700 dark:text-gray-400">Пользователи системы</span>
26 </label>
27 <table class="w-full whitespace-no-wrap">
28 <thead>
29 <tr
30 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"
31 >
32 <th class="px-4 py-3">№</th>
33 <th class="px-4 py-3">Имя пользователя</th>
34 <th class="px-4 py-3">Добавленные в группу</th>
35 </tr>
36 </thead>
37 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
38 @foreach($users as $user)
39 <tr class="text-gray-700 dark:text-gray-400">
40 <td class="px-4 py-3">
41 {{$user->id}}
42 </td>
43 <td class="px-4 py-3">
44 {{$user->name}}
45 </td>
46 <td class="px-4 py-3">
47 <input type="checkbox" id="user{{$user->id}}" name="usergroup[]" value="{{$user->id}}" <?php //if ($user->groups->group_user_id == $group->id) {?>checked<?//}?>/>
48 <pre><? //print_r($user->ingroup->id);?></pre>
49 </td>
50 </tr>
51 @endforeach
52 </tbody>
53 </table>
54
55
24 </div> 56 </div>
25 57
resources/views/admin/groups/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Группы пользователей']) 1 @extends('layout.admin', ['title' => 'Админка - Группы пользователей'])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.checkban', function () { 6 $(document).on('click', '.checkban', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var ajax_block = $('#ajax_block'); 9 var ajax_block = $('#ajax_block');
10 var bool = 0; 10 var bool = 0;
11 11
12 if(this.checked){ 12 if(this.checked){
13 bool = 1; 13 bool = 1;
14 } else { 14 } else {
15 bool = 0; 15 bool = 0;
16 } 16 }
17 17
18 $.ajax({ 18 $.ajax({
19 type: "GET", 19 type: "GET",
20 url: "{{ url()->full()}}", 20 url: "{{ url()->full()}}",
21 data: "id=" + value + "&is_ban=" + bool, 21 data: "id=" + value + "&is_ban=" + bool,
22 success: function (data) { 22 success: function (data) {
23 console.log('Обновление таблицы пользователей '); 23 console.log('Обновление таблицы пользователей ');
24 //data = JSON.parse(data); 24 //data = JSON.parse(data);
25 //console.log(data); 25 //console.log(data);
26 ajax_block.html(data); 26 ajax_block.html(data);
27 }, 27 },
28 headers: { 28 headers: {
29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
30 }, 30 },
31 error: function (data) { 31 error: function (data) {
32 console.log('Error: ' + data); 32 console.log('Error: ' + data);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 36
37 }); 37 });
38 </script> 38 </script>
39 @endsection 39 @endsection
40 40
41 @section('search') 41 @section('search')
42 <!--<div class="absolute inset-y-0 flex items-center pl-2"> 42 <!--<div class="absolute inset-y-0 flex items-center pl-2">
43 <svg 43 <svg
44 class="w-4 h-4" 44 class="w-4 h-4"
45 aria-hidden="true" 45 aria-hidden="true"
46 fill="currentColor" 46 fill="currentColor"
47 viewBox="0 0 20 20" 47 viewBox="0 0 20 20"
48 > 48 >
49 <path 49 <path
50 fill-rule="evenodd" 50 fill-rule="evenodd"
51 d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" 51 d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
52 clip-rule="evenodd" 52 clip-rule="evenodd"
53 ></path> 53 ></path>
54 </svg> 54 </svg>
55 </div> 55 </div>
56 <form action="" method="POST"> 56 <form action="" method="POST">
57 <div style="float:left;"><input 57 <div style="float:left;"><input
58 class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input" 58 class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
59 style="width: 400px" 59 style="width: 400px"
60 type="text" 60 type="text"
61 placeholder="Искать..." 61 placeholder="Искать..."
62 aria-label="Search" 62 aria-label="Search"
63 /></div> 63 /></div>
64 <div style="float: left"> 64 <div style="float: left">
65 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> 65 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
66 </div> 66 </div>
67 </form>--> 67 </form>-->
68 @endsection 68 @endsection
69 69
70 @section('content') 70 @section('content')
71 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 71 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
72 <div class="w-full overflow-x-auto"> 72 <div class="w-full overflow-x-auto">
73 <a 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" href="{{ route('admin.add-group') }}">Создать группу</a><br><br> 73 <a 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" href="{{ route('admin.add-group') }}">Создать группу</a><br><br>
74 <table class="w-full whitespace-no-wrap"> 74 <table class="w-full whitespace-no-wrap">
75 <thead> 75 <thead>
76 <tr 76 <tr
77 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" 77 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"
78 > 78 >
79 <th class="px-4 py-3">№</th> 79 <th class="px-4 py-3">№</th>
80 <th class="px-4 py-3">Название группы</th> 80 <th class="px-4 py-3">Название группы</th>
81 <th class="px-4 py-3">Создатель группы</th> 81 <th class="px-4 py-3">Создатель группы</th>
82 <th class="px-4 py-3">Кол-во участников</th> 82 <th class="px-4 py-3">Кол-во участников</th>
83 <th class="px-4 py-3">Дата регистрации</th> 83 <th class="px-4 py-3">Дата регистрации</th>
84 <th class="px-4 py-3">Изменить</th> 84 <th class="px-4 py-3">Изменить</th>
85 </tr> 85 </tr>
86 </thead> 86 </thead>
87 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 87 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
88 @foreach($groups as $group) 88 @foreach($groups as $group)
89 <tr class="text-gray-700 dark:text-gray-400"> 89 <tr class="text-gray-700 dark:text-gray-400">
90 <td class="px-4 py-3"> 90 <td class="px-4 py-3">
91 {{$group->id}} 91 {{$group->id}}
92 </td> 92 </td>
93 <td class="px-4 py-3"> 93 <td class="px-4 py-3">
94 {{$group->name_group}} 94 {{$group->name_group}}
95 </td> 95 </td>
96 <td class="px-4 py-3"> 96 <td class="px-4 py-3">
97 {{$group->user->name}} 97 {{$group->user->name}}
98 </td> 98 </td>
99 <td class="px-4 py-3"> 99 <td class="px-4 py-3">
100 {{$group->ingroup->count()}} 100 {{$group->ingroup->count()}}
101 </td> 101 </td>
102 <td class="px-4 py-3 text-sm"> 102 <td class="px-4 py-3 text-sm">
103 {{ $group->created_at }} 103 {{ $group->created_at }}
104 </td> 104 </td>
105 <td class="px-4 py-3 text-sm"> 105 <td class="px-4 py-3 text-sm_">
106 <a href="{{ route('admin.edit-group', ['group' => $group->id]) }}">Изменить</a> 106 <form action="{{ route('admin.delete-group', ['group' => $group->id]) }}" method="POST">
107 <a href="{{ route('admin.edit-group', ['group' => $group->id]) }}">Изменить</a> |
108 @csrf
109 @method('DELETE')
110 <input class="btn btn-danger" type="submit" value="Удалить"/>
111 </form>
107 </td> 112 </td>
108 </tr> 113 </tr>
109 @endforeach 114 @endforeach
110 </tbody> 115 </tbody>
111 </table> 116 </table>
112 </div> 117 </div>
113 118
114 <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"> 119 <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">
115 <?=$groups->appends($_GET)->links('admin.pagginate'); ?> 120 <?=$groups->appends($_GET)->links('admin.pagginate'); ?>
116 </div> 121 </div>
117 </div> 122 </div>
118 @endsection 123 @endsection
119 124
resources/views/admin/static/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Страница статистики'])
2
3 @section('content')
4
5 <!-- Таблицы -->
6 <div class="w-full overflow-hidden rounded-lg shadow-xs">
7 <div class="w-full overflow-x-auto">
8 <table class="w-full whitespace-no-wrap">
9 <thead>
10 <tr
11 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"
12 >
13 <th class="px-4 py-3">Название</th>
14 <th class="px-4 py-3">Ссылка</th>
15 </tr>
16 </thead>
17 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
18 <tr class="text-gray-700 dark:text-gray-400">
19 <td class="px-4 py-3">
20 <div class="flex items-center text-sm">
21 <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
22 <div
23 class="absolute inset-0 rounded-full shadow-inner"
24 aria-hidden="true"
25 ></div>
26 </div>
27 <div>
28 <p class="font-semibold">Статистика пользователей</p>
29 <p class="text-xs text-gray-600 dark:text-gray-400">
30 Информация о просмотрах и сообщениях пользователей разбитая по месяцам
31 </p>
32 </div>
33 </div>
34 </td>
35 <td class="px-4 py-3 text-sm">
36 <a href="{{ route('admin.static-workers') }}">Ссылка</a>
37 </td>
38 </tr>
39 <tr class="text-gray-700 dark:text-gray-400">
40 <td class="px-4 py-3">
41 <div class="flex items-center text-sm">
42 <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
43 <div
44 class="absolute inset-0 rounded-full shadow-inner"
45 aria-hidden="true"
46 ></div>
47 </div>
48 <div>
49 <p class="font-semibold">Статистика вакансий</p>
50 <p class="text-xs text-gray-600 dark:text-gray-400">
51 Информация о просмотрах и отликах о вакансиях (по месяцам)
52 </p>
53 </div>
54 </div>
55 </td>
56 <td class="px-4 py-3 text-sm">
57 <a href="{{ route('admin.static-ads') }}">Ссылка</a>
58 </td>
59 </tr>
60
61 </tbody>
62 </table>
63 </div>
64 </div>
65 @endsection
66
resources/views/admin/users/roles/index.blade.php
File was created 1 @extends('layout.admin', ['title' => 'Роли пользователей'])
2
3 @section('script')
4 <script>
5 $(document).ready(function() {
6 $(document).on('click', '.check_click', function () {
7 var this_ = $(this);
8 var value = this_.val();
9 var field = this_.attr('data-field');
10 var ajax_block = $('#ajax_block');
11 var bool = 0;
12 var str_get = '';
13
14 if(this.checked){
15 bool = 1;
16 } else {
17 bool = 0;
18 }
19 console.log(field);
20 str_get = "id=" + value + "&" + field + "=" + bool;
21 console.log(str_get);
22
23 $.ajax({
24 type: "GET",
25 url: "{{ url()->full()}}",
26 data: str_get,
27 success: function (data) {
28 console.log('Обновление таблицы пользователей ');
29 //data = JSON.parse(data);
30 //console.log(data);
31 ajax_block.html(data);
32 },
33 headers: {
34 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
35 },
36 error: function (data) {
37 console.log('Error: ' + data);
38 }
39 });
40 });
41 });
42 </script>
43 @endsection
44
45 @section('search')
46 <div class="absolute inset-y-0 flex items-center pl-2">
47 <svg
48 class="w-4 h-4"
49 aria-hidden="true"
50 fill="currentColor"
51 viewBox="0 0 20 20"
52 >
53 <path
54 fill-rule="evenodd"
55 d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
56 clip-rule="evenodd"
57 ></path>
58 </svg>
59 </div>
60 <form action="" method="POST">
61 <div style="float:left;"><input
62 class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
63 style="width: 400px"
64 type="text"
65 placeholder="Искать..."
66 aria-label="Search"
67 /></div>
68 <div style="float: left">
69 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
70 </div>
71 </form>
72 @endsection
73
74 @section('content')
75 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
76 <div class="w-full overflow-x-auto">
77 <table class="w-full whitespace-no-wrap">
78 <thead>
79 <tr
80 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"
81 >
82 <th class="px-4 py-3">№</th>
83 <th class="px-4 py-3">Имя</th>
84 <th class="px-4 py-3">Email/логин</th>
85 <th class="px-4 py-3">Просмотр резюме</th>
86 <th class="px-4 py-3">Отправка сообщений</th>
87 <th class="px-4 py-3">Публикация вакансий</th>
88 <th class="px-4 py-3">Админ</th>
89 <!--<th class="px-4 py-3">Дата регистрации</th>-->
90 </tr>
91 </thead>
92 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
93 @foreach($users as $user)
94 <tr class="text-gray-700 dark:text-gray-400">
95 <td class="px-4 py-3">
96 {{$user->id}}
97 </td>
98 <td class="px-4 py-3">
99 {{ $user->name }}
100 </td>
101 <td class="px-4 py-3 text-sm">
102 {{ $user->email }}
103 </td>
104 <td class="px-4 py-3 text-sm">
105 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_lookin" name="lookin_{{$user->id}}" {{ ($user->is_lookin) ? "checked" : "" }}/>
106 </td>
107
108 <td class="px-4 py-3 text-sm">
109 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_message" name="message_{{$user->id}}" {{ ($user->is_message) ? "checked" : "" }}/>
110 </td>
111
112 <td class="px-4 py-3 text-sm">
113 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_public" name="public_{{$user->id}}" {{ ($user->is_public) ? "checked" : "" }}/>
114 </td>
115
116 <td class="px-4 py-3 text-sm">
117 @if ($user->id > 1)
118 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
119 @endif
120 </td>
121
122 <!--<td class="px-4 py-3 text-sm">
123 {{ $user->created_at }}
124 </td>-->
125 </tr>
126 @endforeach
127 </tbody>
128 </table>
129 </div>
130
131 <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">
132 <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
133 <?=$users->links('admin.pagginate'); ?>
134 </div>
135
136
137 <!--<div
138 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"
139 >
140 <span class="flex items-center col-span-3">
141 Showing 21-30 of 100
142 </span>
143 <span class="col-span-2"></span>
144
145 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end">
146 <nav aria-label="Table navigation">
147 <ul class="inline-flex items-center">
148 <li>
149 <button
150 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple"
151 aria-label="Previous"
152 >
153 <svg
154 aria-hidden="true"
155 class="w-4 h-4 fill-current"
156 viewBox="0 0 20 20"
157 >
158 <path
159 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
160 clip-rule="evenodd"
161 fill-rule="evenodd"
162 ></path>
163 </svg>
164 </button>
165 </li>
166 <li>
167 <button
168 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
169 >
170 1
171 </button>
172 </li>
173 <li>
174 <button
175 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
176 >
177 2
178 </button>
179 </li>
180 <li>
181 <button
182 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple"
183 >
184 3
185 </button>
186 </li>
187 <li>
188 <button
189 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
190 >
191 4
192 </button>
193 </li>
194 <li>
195 <span class="px-3 py-1">...</span>
196 </li>
197 <li>
198 <button
199 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
200 >
201 8
202 </button>
203 </li>
204 <li>
205 <button
206 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
207 >
208 9
209 </button>
210 </li>
211 <li>
212 <button
213 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple"
214 aria-label="Next"
215 >
216 <svg
217 class="w-4 h-4 fill-current"
218 aria-hidden="true"
219 viewBox="0 0 20 20"
220 >
221 <path
222 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
223 clip-rule="evenodd"
224 fill-rule="evenodd"
225 ></path>
226 </svg>
227 </button>
228 </li>
229 </ul>
230 </nav>
231 </span>
232 </div>-->
233 </div>
234
235 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?>
236
237
238 @endsection
239
resources/views/admin/users/roles/index_ajax.blade.php
File was created 1 <div class="w-full overflow-x-auto">
2 <table class="w-full whitespace-no-wrap">
3 <thead>
4 <tr
5 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"
6 >
7 <th class="px-4 py-3">№</th>
8 <th class="px-4 py-3">Имя</th>
9 <th class="px-4 py-3">Email/логин</th>
10 <th class="px-4 py-3">Просмотр резюме</th>
11 <th class="px-4 py-3">Отправка сообщений</th>
12 <th class="px-4 py-3">Публикация вакансий</th>
13 <th class="px-4 py-3">Админ</th>
14 <!--<th class="px-4 py-3">Дата регистрации</th>-->
15 </tr>
16 </thead>
17 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
18 @foreach($users as $user)
19 <tr class="text-gray-700 dark:text-gray-400">
20 <td class="px-4 py-3">
21 {{$user->id}}
22 </td>
23 <td class="px-4 py-3">
24 {{ $user->name }}
25 </td>
26 <td class="px-4 py-3 text-sm">
27 {{ $user->email }}
28 </td>
29 <td class="px-4 py-3 text-sm">
30 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_lookin" name="lookin_{{$user->id}}" {{ ($user->is_lookin) ? "checked" : "" }}/>
31 </td>
32
33 <td class="px-4 py-3 text-sm">
34 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_message" name="message_{{$user->id}}" {{ ($user->is_message) ? "checked" : "" }}/>
35 </td>
36
37 <td class="px-4 py-3 text-sm">
38 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_public" name="public_{{$user->id}}" {{ ($user->is_public) ? "checked" : "" }}/>
39 </td>
40
41 <td class="px-4 py-3 text-sm">
42 @if ($user->id > 1)
43 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
44 @endif
45 </td>
46
47 <!--<td class="px-4 py-3 text-sm">
48 {{ $user->created_at }}
49 </td>-->
50 </tr>
51 @endforeach
52 </tbody>
53 </table>
54 </div>
55
56 <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">
57 <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
58 <?=$users->links('admin.pagginate'); ?>
59 </div>
60
1 <?php 1 <?php
2 2
3 use App\Http\Controllers\Admin\AdminController; 3 use App\Http\Controllers\Admin\AdminController;
4 use App\Http\Controllers\Admin\CategoryController; 4 use App\Http\Controllers\Admin\CategoryController;
5 use App\Http\Controllers\Admin\EmployersController; 5 use App\Http\Controllers\Admin\EmployersController;
6 use App\Http\Controllers\Admin\UsersController; 6 use App\Http\Controllers\Admin\UsersController;
7 use App\Http\Controllers\Admin\WorkersController; 7 use App\Http\Controllers\Admin\WorkersController;
8 use App\Http\Controllers\Auth\LoginController; 8 use App\Http\Controllers\Auth\LoginController;
9 use App\Http\Controllers\Auth\RegisterController; 9 use App\Http\Controllers\Auth\RegisterController;
10 use App\Models\User; 10 use App\Models\User;
11 use App\Http\Controllers\MainController; 11 use App\Http\Controllers\MainController;
12 use App\Http\Controllers\HomeController; 12 use App\Http\Controllers\HomeController;
13 use Illuminate\Support\Facades\Route; 13 use Illuminate\Support\Facades\Route;
14 use App\Http\Controllers\Admin\CompanyController; 14 use App\Http\Controllers\Admin\CompanyController;
15 use App\Http\Controllers\Admin\Ad_EmployersController; 15 use App\Http\Controllers\Admin\Ad_EmployersController;
16 use App\Http\Controllers\Admin\MsgAnswersController; 16 use App\Http\Controllers\Admin\MsgAnswersController;
17 use App\Http\Controllers\Admin\GroupsController; 17 use App\Http\Controllers\Admin\GroupsController;
18 18
19 19
20 /* 20 /*
21 |-------------------------------------------------------------------------- 21 |--------------------------------------------------------------------------
22 | Web Routes 22 | Web Routes
23 |-------------------------------------------------------------------------- 23 |--------------------------------------------------------------------------
24 | 24 |
25 | Here is where you can register web routes for your application. These 25 | Here is where you can register web routes for your application. These
26 | routes are loaded by the RouteServiceProvider within a group which 26 | routes are loaded by the RouteServiceProvider within a group which
27 | contains the "web" middleware group. Now create something great! 27 | contains the "web" middleware group. Now create something great!
28 | 28 |
29 */ 29 */
30 /* 30 /*
31 Route::get('/', function () { 31 Route::get('/', function () {
32 return view('welcome'); 32 return view('welcome');
33 })->name('index'); 33 })->name('index');
34 */ 34 */
35 Route::get('/', [MainController::class, 'index'])->name('index'); 35 Route::get('/', [MainController::class, 'index'])->name('index');
36 36
37 //Роуты авторизации, регистрации, восстановления, аутентификации 37 //Роуты авторизации, регистрации, восстановления, аутентификации
38 Auth::routes(['verify' => true]); 38 Auth::routes(['verify' => true]);
39 //Личный кабинет пользователя 39 //Личный кабинет пользователя
40 Route::get('/home', [HomeController::class, 'index'])->name('home'); 40 Route::get('/home', [HomeController::class, 'index'])->name('home');
41 41
42 /* 42 /*
43 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { 43 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) {
44 $user = User::where('email',$request->input('email'))->first(); 44 $user = User::where('email',$request->input('email'))->first();
45 45
46 $user->sendEmailVerificationNotification(); 46 $user->sendEmailVerificationNotification();
47 47
48 return 'your response'; 48 return 'your response';
49 })->middleware('throttle:6,1')->name('verification.resend'); 49 })->middleware('throttle:6,1')->name('verification.resend');
50 */ 50 */
51 51
52 // Авторизация, регистрация в админку 52 // Авторизация, регистрация в админку
53 Route::group([ 53 Route::group([
54 'as' => 'admin.', // имя маршрута, например auth.index 54 'as' => 'admin.', // имя маршрута, например auth.index
55 'prefix' => 'admin', // префикс маршрута, например auth/index 55 'prefix' => 'admin', // префикс маршрута, например auth/index
56 'middleware' => ['guest'], 56 'middleware' => ['guest'],
57 ], function () { 57 ], function () {
58 // Форма регистрации 58 // Форма регистрации
59 Route::get('register', [AdminController::class, 'register'])->name('register'); 59 Route::get('register', [AdminController::class, 'register'])->name('register');
60 60
61 // Создание пользователя 61 // Создание пользователя
62 Route::post('register', [AdminController::class, 'create'])->name('create'); 62 Route::post('register', [AdminController::class, 'create'])->name('create');
63 //Форма входа 63 //Форма входа
64 Route::get('login', [AdminController::class, 'login'])->name('login'); 64 Route::get('login', [AdminController::class, 'login'])->name('login');
65 65
66 // аутентификация 66 // аутентификация
67 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 67 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
68 68
69 }); 69 });
70 70
71 // Личный кабинет админки 71 // Личный кабинет админки
72 Route::group([ 72 Route::group([
73 'as' => 'admin.', // имя маршрута, например auth.index 73 'as' => 'admin.', // имя маршрута, например auth.index
74 'prefix' => 'admin', // префикс маршрута, например auth/index 74 'prefix' => 'admin', // префикс маршрута, например auth/index
75 'middleware' => ['auth'], ['admin'], 75 'middleware' => ['auth'], ['admin'],
76 ], function() { 76 ], function() {
77 77
78 // выход 78 // выход
79 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 79 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
80 80
81 // кабинет главная страница 81 // кабинет главная страница
82 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 82 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
83 83
84 // кабинет профиль админа - форма 84 // кабинет профиль админа - форма
85 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 85 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
86 // кабинет профиль админа - сохранение формы 86 // кабинет профиль админа - сохранение формы
87 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 87 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
88 88
89 // кабинет профиль - форма пароли 89 // кабинет профиль - форма пароли
90 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 90 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
91 // кабинет профиль - сохранение формы пароля 91 // кабинет профиль - сохранение формы пароля
92 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 92 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
93 93
94 94
95 // кабинет профиль пользователя - форма 95 // кабинет профиль пользователя - форма
96 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); 96 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile');
97 // кабинет профиль пользователя - сохранение формы 97 // кабинет профиль пользователя - сохранение формы
98 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); 98 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile');
99 99
100 // кабинет профиль работодатель - форма 100 // кабинет профиль работодатель - форма
101 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); 101 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
102 // кабинет профиль работодатель - сохранение формы 102 // кабинет профиль работодатель - сохранение формы
103 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); 103 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
104 104
105 // кабинет профиль работник - форма 105 // кабинет профиль работник - форма
106 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile'); 106 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile');
107 107
108 // кабинет настройки сайта - форма 108 // кабинет настройки сайта - форма
109 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 109 Route::get('config', [AdminController::class, 'config_form'])->name('config');
110 // кабинет настройки сайта сохранение формы 110 // кабинет настройки сайта сохранение формы
111 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 111 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
112 112
113 // кабинет - пользователи 113 // кабинет - пользователи
114 Route::get('users', [UsersController::class, 'index'])->name('users'); 114 Route::get('users', [UsersController::class, 'index'])->name('users');
115 115
116 // кабинет - пользователи 116 // кабинет - пользователи
117 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 117 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
118 118
119 // кабинет - работодатели 119 // кабинет - работодатели
120 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 120 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
121 121
122 // кабинет - соискатели 122 // кабинет - соискатели
123 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 123 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
124 124
125 // кабинет - вакансии 125 // кабинет - вакансии
126 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 126 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
127 127
128 // кабинет - категории 128 // кабинет - категории
129 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 129 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
130 /* 130 /*
131 * CRUD-операции над настройками Компании 131 * CRUD-операции над настройками Компании
132 */ 132 */
133 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 133 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
134 134
135 135
136 // кабинет - должности 136 // кабинет - должности
137 Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); 137 Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
138 138
139 // кабинет - сообщения 139 // кабинет - сообщения
140 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 140 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
141 141
142 // кабинет - группы пользователей 142 // кабинет - группы пользователей
143 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 143 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
144 // кабинет - добавление форма группы пользователей 144 // кабинет - добавление форма группы пользователей
145 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 145 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
146 // кабинет - сохранение формы группы пользователей 146 // кабинет - сохранение формы группы пользователей
147 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 147 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
148 // кабинет - редактирование форма группы пользователей 148 // кабинет - редактирование форма группы пользователей
149 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 149 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
150 // кабинет - сохранение редактированной формы группы пользователей 150 // кабинет - сохранение редактированной формы группы пользователей
151 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 151 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
152 // кабинет - удаление группы пользователей
153 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
152 154
153 // кабинет - список админов 155 // кабинет - список админов
154 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 156 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
155 157
156 /////редактор////// кабинет - редактор сайта//////////////////////// 158 /////редактор////// кабинет - редактор сайта////////////////////////
157 Route::get('editor-site', [CompanyController::class, 'editor'])->name('editor-site'); 159 Route::get('editor-site', [CompanyController::class, 'editor'])->name('editor-site');
158 160
159 // кабинет - редактор шапки-футера сайта 161 // кабинет - редактор шапки-футера сайта
160 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 162 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
161 163
162 // кабинет - редактор должности на главной 164 // кабинет - редактор должности на главной
163 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); 165 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
164 166
165 // кабинет - редактор работодатели на главной 167 // кабинет - редактор работодатели на главной
166 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 168 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
167 169
168 // кабинет - редактор seo-сайта 170 // кабинет - редактор seo-сайта
169 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 171 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
170 172
171 // кабинет - редактор страниц 173 // кабинет - редактор страниц
172 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 174 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
173 175
174 // кабинет - реклама сайта 176 // кабинет - реклама сайта
175 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 177 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
176 //////////////////////////////////////////////////////////////////////// 178 ////////////////////////////////////////////////////////////////////////
177 179
178 // кабинет - отзывы о работодателе для модерации 180 // кабинет - отзывы о работодателе для модерации
179 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 181 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
180 182
181 // Общая страница статистики 183 // Общая страница статистики
182 Route::get('statics', function () { 184 Route::get('statics', function () {
183 return view('admin.static.index'); 185 return view('admin.static.index');
184 })->name('statics'); 186 })->name('statics');
185 187
186 // кабинет - статистика работников 188 // кабинет - статистика работников
187 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 189 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
188 190
189 // кабинет - статистика вакансий работодателя 191 // кабинет - статистика вакансий работодателя
190 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 192 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
191 193
192 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 194 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
193 Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 195 Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
194 196
195 // кабинет - роли пользователя 197 // кабинет - роли пользователя
196 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 198 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
197 199
198 }); 200 });
199 201