Commit dd87a3ce43ad11ea72219a8b2e020a5817572b99
1 parent
e74a6ce9fa
Exists in
master
and in
1 other branch
Реклама-блок, обновление ckeditor обработчика, меню-шапки-футера
Showing 13 changed files with 458 additions and 26 deletions Inline Diff
- app/Http/Controllers/Admin/CompanyController.php
- app/Http/Controllers/CKEditorController.php
- app/Http/Requests/ReclameRequest.php
- app/Models/reclame.php
- public/images/jquery-ui-in-action_1694607980.jpg
- resources/views/admin/editbloks/index.blade.php
- resources/views/admin/editbloks/index_ajax.blade.php
- resources/views/admin/pages/form.blade.php
- resources/views/admin/reclames/add.blade.php
- resources/views/admin/reclames/edit.blade.php
- resources/views/admin/reclames/form.blade.php
- resources/views/admin/reclames/index.blade.php
- routes/web.php
app/Http/Controllers/Admin/CompanyController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Classes\Meta; | 5 | use App\Classes\Meta; |
6 | use App\Http\Controllers\Controller; | 6 | use App\Http\Controllers\Controller; |
7 | use App\Http\Requests\PagesRequest; | 7 | use App\Http\Requests\PagesRequest; |
8 | use App\Http\Requests\ReclameRequest; | ||
8 | use App\Http\Requests\SEORequest; | 9 | use App\Http\Requests\SEORequest; |
9 | use App\Models\Employer; | 10 | use App\Models\Employer; |
10 | use App\Models\employers_main; | 11 | use App\Models\employers_main; |
11 | use App\Models\header_footer; | 12 | use App\Models\header_footer; |
12 | use App\Models\Job_title; | 13 | use App\Models\Job_title; |
13 | use App\Models\job_titles_main; | 14 | use App\Models\job_titles_main; |
14 | use App\Models\pages; | 15 | use App\Models\pages; |
15 | use App\Models\reclame; | 16 | use App\Models\reclame; |
16 | use App\Models\SEO; | 17 | use App\Models\SEO; |
17 | use Illuminate\Http\Request; | 18 | use Illuminate\Http\Request; |
19 | use Illuminate\Support\Facades\Storage; | ||
18 | 20 | ||
19 | class CompanyController extends Controller | 21 | class CompanyController extends Controller |
20 | { | 22 | { |
21 | // кабинет - редактор сайта | 23 | // кабинет - редактор сайта |
22 | public function editor() { | 24 | public function editor() { |
23 | return; | 25 | return; |
24 | } | 26 | } |
25 | 27 | ||
26 | // кабинет - редактор должности на главной | 28 | // кабинет - редактор должности на главной |
27 | public function job_titles_main(Request $request) { | 29 | public function job_titles_main(Request $request) { |
28 | if ($request->ajax()) { | 30 | if ($request->ajax()) { |
29 | $user = job_titles_main::find($request->id); | 31 | $user = job_titles_main::find($request->id); |
30 | $request->offsetUnset('id'); | 32 | $request->offsetUnset('id'); |
31 | $user->update($request->all()); | 33 | $user->update($request->all()); |
32 | } | 34 | } |
33 | 35 | ||
34 | $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10); | 36 | $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10); |
35 | $list_job_titles = Job_title::query()->active()->orderBy('name')->get(); | 37 | $list_job_titles = Job_title::query()->active()->orderBy('name')->get(); |
36 | 38 | ||
37 | if ($request->ajax()) { | 39 | if ($request->ajax()) { |
38 | return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles')); | 40 | return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles')); |
39 | } else { | 41 | } else { |
40 | return view('admin.job_main.index', compact('jobs', 'list_job_titles')); | 42 | return view('admin.job_main.index', compact('jobs', 'list_job_titles')); |
41 | } | 43 | } |
42 | } | 44 | } |
43 | 45 | ||
44 | // кабинет - редактор шапки-футера сайта | 46 | // кабинет - редактор шапки-футера сайта |
45 | public function editblocks() { | 47 | public function editblocks(Request $request) { |
46 | $header_footer = header_footer::query()->OrderBy('name')->paginate(15); | 48 | if ($request->ajax()) { |
47 | return view('admin.editbloks.index', compact('header_footer')); | 49 | $header_footer = header_footer::where('header', $request->header)->OrderBy('sort')->OrderBy('name')->paginate(15); |
50 | $list_menu = header_footer::where('header', $request->header)->OrderBy('name')->get(); | ||
51 | return view('admin.editbloks.index_ajax', compact('header_footer')); | ||
52 | } else { | ||
53 | $header_footer = header_footer::where('header', '1')->OrderBy('sort')->OrderBy('name')->paginate(15); | ||
54 | $list_menu = header_footer::where('header', '1')->OrderBy('name')->get(); | ||
55 | return view('admin.editbloks.index', compact('header_footer')); | ||
56 | } | ||
48 | } | 57 | } |
49 | 58 | ||
50 | // кабинет - редактор работодатели на главной | 59 | // кабинет - редактор работодатели на главной |
51 | public function employers_main(Request $request) { | 60 | public function employers_main(Request $request) { |
52 | if ($request->ajax()) { | 61 | if ($request->ajax()) { |
53 | $user = employers_main::find($request->id); | 62 | $user = employers_main::find($request->id); |
54 | $request->offsetUnset('id'); | 63 | $request->offsetUnset('id'); |
55 | $user->update($request->all()); | 64 | $user->update($request->all()); |
56 | } | 65 | } |
57 | 66 | ||
58 | $employers = employers_main::query()->OrderBy('sort')->paginate(10); | 67 | $employers = employers_main::query()->OrderBy('sort')->paginate(10); |
59 | $list_employers = Employer::query()->active()->orderBy('name_company')->get(); | 68 | $list_employers = Employer::query()->active()->orderBy('name_company')->get(); |
60 | 69 | ||
61 | if ($request->ajax()) { | 70 | if ($request->ajax()) { |
62 | return view('admin.employer_main.index_ajax', compact('employers', 'list_employers')); | 71 | return view('admin.employer_main.index_ajax', compact('employers', 'list_employers')); |
63 | } else { | 72 | } else { |
64 | return view('admin.employer_main.index', compact('employers', 'list_employers')); | 73 | return view('admin.employer_main.index', compact('employers', 'list_employers')); |
65 | } | 74 | } |
66 | } | 75 | } |
67 | 76 | ||
68 | //////////// кабинет - редактор seo-сайта ///////////////////////////// | 77 | //////////// кабинет - редактор seo-сайта ///////////////////////////// |
69 | public function editor_seo() { | 78 | public function editor_seo() { |
70 | $pages = SEO::query()->OrderBy('url')->paginate(15); | 79 | $pages = SEO::query()->OrderBy('url')->paginate(15); |
71 | return view('admin.seo.index', compact('pages')); | 80 | return view('admin.seo.index', compact('pages')); |
72 | } | 81 | } |
73 | 82 | ||
74 | public function editor_seo_add() { | 83 | public function editor_seo_add() { |
75 | return view('admin.seo.add'); | 84 | return view('admin.seo.add'); |
76 | } | 85 | } |
77 | 86 | ||
78 | public function editor_seo_store(SEORequest $request) { | 87 | public function editor_seo_store(SEORequest $request) { |
79 | SEO::create($request->all()); | 88 | SEO::create($request->all()); |
80 | return redirect()->route('admin.editor-seo'); | 89 | return redirect()->route('admin.editor-seo'); |
81 | } | 90 | } |
82 | 91 | ||
83 | public function editor_seo_ajax(Request $request) { | 92 | public function editor_seo_ajax(Request $request) { |
84 | $url = $request->get('url'); // post('url'); | 93 | $url = $request->get('url'); // post('url'); |
85 | $metaData = Array(); | 94 | $metaData = Array(); |
86 | //$url = json_decode($url, true); | 95 | //$url = json_decode($url, true); |
87 | 96 | ||
88 | if (!empty($url)) { | 97 | if (!empty($url)) { |
89 | 98 | ||
90 | $meta = new Meta($url); | 99 | $meta = new Meta($url); |
91 | $meta->parse(); | 100 | $meta->parse(); |
92 | $metaData = $meta->finalize(); | 101 | $metaData = $meta->finalize(); |
93 | 102 | ||
94 | return json_encode($metaData); | 103 | return json_encode($metaData); |
95 | } else { | 104 | } else { |
96 | return json_encode(Array('Error URL')); | 105 | return json_encode(Array('Error URL')); |
97 | } | 106 | } |
98 | } | 107 | } |
99 | 108 | ||
100 | public function editor_seo_edit(SEO $page) { | 109 | public function editor_seo_edit(SEO $page) { |
101 | return view('admin.seo.edit', compact('page')); | 110 | return view('admin.seo.edit', compact('page')); |
102 | } | 111 | } |
103 | 112 | ||
104 | public function editor_seo_update(SEORequest $request, SEO $page) { | 113 | public function editor_seo_update(SEORequest $request, SEO $page) { |
105 | $page->update($request->all()); | 114 | $page->update($request->all()); |
106 | return redirect()->route('admin.editor-seo'); | 115 | return redirect()->route('admin.editor-seo'); |
107 | } | 116 | } |
108 | 117 | ||
109 | public function editor_seo_destroy(SEO $page) { | 118 | public function editor_seo_destroy(SEO $page) { |
110 | $page->delete(); | 119 | $page->delete(); |
111 | return redirect()->route('admin.editor-seo'); | 120 | return redirect()->route('admin.editor-seo'); |
112 | } | 121 | } |
113 | /////////////////////////////////////////////////////////////////////// | 122 | /////////////////////////////////////////////////////////////////////// |
114 | 123 | ||
115 | /////////// кабинет - редактор страниц //////////////////////////////// | 124 | /////////// кабинет - редактор страниц //////////////////////////////// |
116 | public function editor_pages() { | 125 | public function editor_pages() { |
117 | $pages = pages::query()->OrderBy('name')->paginate(15); | 126 | $pages = pages::query()->OrderBy('name')->paginate(15); |
118 | return view('admin.pages.index', compact('pages')); | 127 | return view('admin.pages.index', compact('pages')); |
119 | } | 128 | } |
120 | 129 | ||
121 | public function editor_pages_add() { | 130 | public function editor_pages_add() { |
122 | return view('admin.pages.add'); | 131 | return view('admin.pages.add'); |
123 | } | 132 | } |
124 | 133 | ||
125 | public function editor_pages_store(PagesRequest $request) { | 134 | public function editor_pages_store(PagesRequest $request) { |
126 | pages::create($request->all()); | 135 | $params = $request->all(); |
136 | if ($request->has('image')) { | ||
137 | $params['image'] = $request->file('image')->store('pages', 'public'); | ||
138 | } | ||
139 | |||
140 | pages::create($params); | ||
127 | return redirect()->route('admin.editor-pages'); | 141 | return redirect()->route('admin.editor-pages'); |
128 | } | 142 | } |
129 | 143 | ||
130 | public function editor_pages_edit(pages $page) { | 144 | public function editor_pages_edit(pages $page) { |
131 | return view('admin.pages.edit', compact('page')); | 145 | return view('admin.pages.edit', compact('page')); |
132 | } | 146 | } |
133 | 147 | ||
134 | public function editor_pages_update(PagesRequest $request, pages $page) { | 148 | public function editor_pages_update(PagesRequest $request, pages $page) { |
135 | $page->update($request->all()); | 149 | $params = $request->all(); |
150 | |||
151 | if ($request->has('image')) { | ||
152 | if (!empty($page->image)) Storage::delete($page->image); | ||
153 | $params['image'] = $request->file('image')->store('pages', 'public'); | ||
154 | } else { | ||
155 | if (!empty($page->image)) $params['image'] = $page->image; | ||
156 | } | ||
157 | |||
158 | $page->update($params); | ||
136 | return redirect()->route('admin.editor-pages'); | 159 | return redirect()->route('admin.editor-pages'); |
137 | } | 160 | } |
138 | 161 | ||
139 | public function editor_pages_destroy(pages $page) { | 162 | public function editor_pages_destroy(pages $page) { |
140 | $page->delete(); | 163 | $page->delete(); |
141 | return redirect()->route('admin.editor-pages'); | 164 | return redirect()->route('admin.editor-pages'); |
142 | } | 165 | } |
143 | /////////////////////////////////////////////////////////////////// | 166 | /////////////////////////////////////////////////////////////////// |
144 | 167 | ||
145 | // кабинет - реклама сайта | 168 | ////// кабинет - реклама сайта //////////////////////////////////// |
146 | public function reclames() { | 169 | public function reclames() { |
147 | $reclames = reclame::query()->OrderBy('title')->paginate(15); | 170 | $reclames = reclame::query()->OrderBy('title')->paginate(15); |
148 | return view('admin.reclames.index', compact('reclames')); | 171 | return view('admin.reclames.index', compact('reclames')); |
149 | } | 172 | } |
173 | |||
174 | public function reclames_add() { | ||
175 | return view('admin.reclames.add'); | ||
176 | } | ||
177 | |||
178 | public function reclames_store(ReclameRequest $request) { | ||
179 | $params = $request->all(); | ||
180 | /*if('on' == $request->get('is_hidden')) { | ||
181 | $params['is_hidden'] = 1; | ||
182 | } else { | ||
183 | $params['is_hidden'] = 0; | ||
184 | }*/ | ||
185 | if ($request->has('image')) { | ||
186 | $params['image'] = $request->file('image')->store('reclames', 'public'); | ||
187 | } | ||
188 | |||
189 | reclame::create($params); | ||
190 | return redirect()->route('admin.reclames'); | ||
191 | } | ||
192 | |||
193 | public function reclames_edit(reclame $reclame) { | ||
194 | return view('admin.reclames.edit', compact('reclame')); | ||
195 | } | ||
196 | |||
197 | public function reclames_update(ReclameRequest $request, reclame $reclame) { | ||
198 | $params = $request->all(); | ||
199 | /*if('on' == $request->get('is_hidden')) { | ||
200 | $params['is_hidden'] = 1; | ||
201 | } else { | ||
202 | $params['is_hidden'] = 0; | ||
203 | }*/ | ||
204 | |||
205 | if ($request->has('image')) { | ||
206 | if (!empty($reclame->image)) Storage::delete($reclame->image); | ||
207 | $params['image'] = $request->file('image')->store('reclames', 'public'); | ||
208 | } else { | ||
209 | if (!empty($reclame->image)) $params['image'] = $reclame->image; | ||
210 | } | ||
211 | |||
212 | $reclame->update($params); | ||
213 | return redirect()->route('admin.reclames'); | ||
214 | } | ||
215 | |||
216 | public function reclames_destroy(reclame $reclame) { | ||
217 | $reclame->delete(); | ||
218 | return redirect()->route('admin.reclames'); | ||
219 | } | ||
220 | |||
221 | ///////////////////////////////////////////////////////////////// | ||
150 | } | 222 | } |
151 | 223 |
app/Http/Controllers/CKEditorController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use Illuminate\Http\Request; | 5 | use Illuminate\Http\Request; |
6 | use Illuminate\Support\Facades\Storage; | ||
6 | 7 | ||
7 | class CKEditorController extends Controller | 8 | class CKEditorController extends Controller |
8 | { | 9 | { |
9 | public function upload(Request $request) | 10 | public function upload(Request $request) |
10 | { | 11 | { |
11 | if($request->hasFile('upload')) { | 12 | if($request->hasFile('upload')) { |
12 | $originName = $request->file('upload')->getClientOriginalName(); | 13 | /*$originName = $request->file('upload')->getClientOriginalName(); |
13 | $fileName = pathinfo($originName, PATHINFO_FILENAME); | 14 | $fileName = pathinfo($originName, PATHINFO_FILENAME); |
14 | $extension = $request->file('upload')->getClientOriginalExtension(); | 15 | $extension = $request->file('upload')->getClientOriginalExtension(); |
15 | $fileName = $fileName.'_'.time().'.'.$extension; | 16 | $fileName = $fileName.'_'.time().'.'.$extension; |
16 | $request->file('upload')->move(public_path('images'), $fileName); | 17 | $request->file('upload')->move(public_path('images'), $fileName); |
17 | $CKEditorFuncNum = $request->input('CKEditorFuncNum'); | 18 | $CKEditorFuncNum = $request->input('CKEditorFuncNum'); |
18 | $url = asset('images/'.$fileName); | 19 | $url = asset('images/'.$fileName); */ |
20 | $CKEditorFuncNum = $request->input('CKEditorFuncNum'); | ||
21 | $url = asset(Storage::url($request->file('upload')->store('pages', 'public'))); | ||
19 | $msg = 'Image successfully uploaded'; | 22 | $msg = 'Image successfully uploaded'; |
20 | $response = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>"; | 23 | $response = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>"; |
21 | 24 | ||
22 | @header('Content-type: text/html; charset=utf-8'); | 25 | @header('Content-type: text/html; charset=utf-8'); |
23 | echo $response; | 26 | echo $response; |
24 | } | 27 | } |
25 | } | 28 | } |
26 | } | 29 | } |
27 | 30 |
app/Http/Requests/ReclameRequest.php
File was created | 1 | <?php | |
2 | |||
3 | namespace App\Http\Requests; | ||
4 | |||
5 | use Illuminate\Foundation\Http\FormRequest; | ||
6 | |||
7 | class ReclameRequest 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 | 'title' => [ | ||
28 | 'required', | ||
29 | 'string', | ||
30 | 'min:3', | ||
31 | 'max:255', | ||
32 | ], | ||
33 | 'image' => [ | ||
34 | 'mimes:jpeg,jpg,png', | ||
35 | 'max:15000', | ||
36 | ], | ||
37 | 'position' => [ | ||
38 | 'required', | ||
39 | 'numeric', | ||
40 | 'min:0', | ||
41 | ], | ||
42 | ]; | ||
43 | } | ||
44 | |||
45 | public function messages() { | ||
46 | return [ | ||
47 | 'required' => 'Поле :attribute обязательно для ввода', | ||
48 | 'unique' => 'Поле :attribute должно быть уникальным', | ||
49 | 'mimes' => 'Допускаются файлы только с расширением jpeg,jpg,png', | ||
50 | 'numeric' => 'Поле :attribute должно быть числом', | ||
51 | 'min' => [ | ||
52 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | ||
53 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | ||
54 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | ||
55 | ], | ||
56 | |||
57 | 'max' => [ | ||
58 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | ||
59 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | ||
60 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | ||
61 | ], | ||
62 | |||
63 | ]; | ||
64 | } | ||
65 | } | ||
66 |
app/Models/reclame.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 reclame extends Model | 8 | class reclame extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | |||
12 | protected $fillable = [ | ||
13 | 'title', | ||
14 | 'image', | ||
15 | 'link', | ||
16 | 'text', | ||
17 | 'position', | ||
18 | 'is_hidden', | ||
19 | 'col_vo_click', | ||
20 | 'is_remove', | ||
21 | ]; | ||
11 | } | 22 | } |
12 | 23 |
public/images/jquery-ui-in-action_1694607980.jpg
9.22 KB
resources/views/admin/editbloks/index.blade.php
1 | @extends('layout.admin', ['title' => 'Админка - Редактор шапки-футера сайта']) | 1 | @extends('layout.admin', ['title' => 'Админка - Редактор шапки-футера сайта']) |
2 | 2 | ||
3 | @section('script') | 3 | @section('script') |
4 | <script> | ||
5 | $(document).ready(function() { | ||
6 | $(document).on('chance', '#header', function () { | ||
7 | var this_ = $(this); | ||
8 | var value = this_.val(); | ||
9 | var ajax_block = $('#ajax_block'); | ||
4 | 10 | ||
11 | $.ajax({ | ||
12 | type: "GET", | ||
13 | url: "{{ url()->full()}}", | ||
14 | data: "header=" + value, | ||
15 | success: function (data) { | ||
16 | console.log('Обновление таблицы меню '); | ||
17 | ajax_block.html(data); | ||
18 | }, | ||
19 | headers: { | ||
20 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | ||
21 | }, | ||
22 | error: function (data) { | ||
23 | console.log('Error: ' + data); | ||
24 | } | ||
25 | }); | ||
26 | }); | ||
27 | |||
28 | }); | ||
29 | </script> | ||
5 | @endsection | 30 | @endsection |
6 | 31 | ||
7 | @section('search') | 32 | @section('search') |
8 | <!--<div class="absolute inset-y-0 flex items-center pl-2"> | 33 | <!--<div class="absolute inset-y-0 flex items-center pl-2"> |
9 | <svg | 34 | <svg |
10 | class="w-4 h-4" | 35 | class="w-4 h-4" |
11 | aria-hidden="true" | 36 | aria-hidden="true" |
12 | fill="currentColor" | 37 | fill="currentColor" |
13 | viewBox="0 0 20 20" | 38 | viewBox="0 0 20 20" |
14 | > | 39 | > |
15 | <path | 40 | <path |
16 | fill-rule="evenodd" | 41 | fill-rule="evenodd" |
17 | 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" | 42 | 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" |
18 | clip-rule="evenodd" | 43 | clip-rule="evenodd" |
19 | ></path> | 44 | ></path> |
20 | </svg> | 45 | </svg> |
21 | </div> | 46 | </div> |
22 | <form action="" method="POST"> | 47 | <form action="" method="POST"> |
23 | <div style="float:left;"><input | 48 | <div style="float:left;"><input |
24 | 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" | 49 | 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" |
25 | style="width: 400px" | 50 | style="width: 400px" |
26 | type="text" | 51 | type="text" |
27 | placeholder="Искать..." | 52 | placeholder="Искать..." |
28 | aria-label="Search" | 53 | aria-label="Search" |
29 | /></div> | 54 | /></div> |
30 | <div style="float: left"> | 55 | <div style="float: left"> |
31 | <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> | 56 | <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> |
32 | </div> | 57 | </div> |
33 | </form>--> | 58 | </form>--> |
34 | @endsection | 59 | @endsection |
35 | 60 | ||
36 | @section('content') | 61 | @section('content') |
37 | 62 | ||
38 | <a href="{{ route('admin.add-seo') }}" style="width: 145px" 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"> | 63 | <a href="{{ route('admin.add-seo') }}" style="width: 145px" 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"> |
39 | Добавить опцию | 64 | Добавить опцию |
40 | </a> | 65 | </a> |
66 | <select name="header" id="header" class="form-control"> | ||
67 | <option value="1">Шапка</option> | ||
68 | <option value="0">Футер</option> | ||
69 | </select> | ||
70 | |||
41 | <br> | 71 | <br> |
42 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | 72 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
43 | 73 | ||
44 | <div class="w-full overflow-x-auto"> | 74 | <div class="w-full overflow-x-auto"> |
45 | <table class="w-full whitespace-no-wrap"> | 75 | <table class="w-full whitespace-no-wrap"> |
46 | <thead> | 76 | <thead> |
47 | <tr | 77 | <tr |
48 | 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 | 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" |
49 | > | 79 | > |
50 | <th class="px-4 py-3">№</th> | 80 | <th class="px-4 py-3">№</th> |
51 | <th class="px-4 py-3">Название</th> | 81 | <th class="px-4 py-3">Название</th> |
52 | <th class="px-4 py-3">Ссылка</th> | 82 | <th class="px-4 py-3">Ссылка</th> |
53 | <th class="px-4 py-3">Категория</th> | 83 | <th class="px-4 py-3">Родитель</th> |
54 | <th class="px-4 py-3">Шапка</th> | 84 | <th class="px-4 py-3">Сортировка</th> |
55 | <th class="px-4 py-3">Дата создания</th> | 85 | <th class="px-4 py-3">Дата создания</th> |
56 | <th class="px-4 py-3">Редактировать</th> | 86 | <th class="px-4 py-3">Редактировать</th> |
57 | </tr> | 87 | </tr> |
58 | </thead> | 88 | </thead> |
59 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | 89 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
60 | @foreach($header_footer as $page) | 90 | @foreach($header_footer as $page) |
61 | <tr class="text-gray-700 dark:text-gray-400"> | 91 | <tr class="text-gray-700 dark:text-gray-400"> |
62 | <td class="px-4 py-3"> | 92 | <td class="px-4 py-3"> |
63 | {{$page->id}} | 93 | {{$page->id}} |
64 | </td> | 94 | </td> |
65 | <td class="px-4 py-3"> | 95 | <td class="px-4 py-3"> |
66 | {{$page->name}} | 96 | {{$page->name}} |
67 | </td> | 97 | </td> |
68 | <td class="px-4 py-3"> | 98 | <td class="px-4 py-3"> |
69 | {{$page->link}} | 99 | {{$page->link}} |
70 | </td> | 100 | </td> |
71 | <td class="px-4 py-3"> | 101 | <td class="px-4 py-3"> |
72 | {{$page->category}} ({{$page->code_id}}) | 102 | <select name="code_id{{$page->code_id}}" id="{{$page->id}}" data-field="code_id" class="form-control check_js"> |
103 | <option value="0" | ||
104 | @if($page->code_id == 0) | ||
105 | selected | ||
106 | @endif | ||
107 | >Не указано</option> | ||
108 | @isset($list_menu) | ||
109 | @foreach($list_menu as $menu) | ||
110 | <option value="{{ $menu->id }}" | ||
111 | @if($menu->id == $page->code_id) | ||
112 | selected | ||
113 | @endif | ||
114 | >{{ $menu->name }} ({{ $menu->id }})</option> | ||
115 | @endforeach | ||
116 | @endisset | ||
117 | </select> | ||
73 | </td> | 118 | </td> |
119 | <td class="px-4 py-3 text-sm"> | ||
120 | <select name="sort{{$page->id}}" id="{{$page->id}}" data-field="sort" class="form-control check_js"> | ||
121 | <option value="100" @if($page->sort == '100') selected @endif>100</option> | ||
122 | <option value="110" @if($page->sort == '110') selected @endif>110</option> | ||
123 | <option value="120" @if($page->sort == '120') selected @endif>120</option> | ||
124 | <option value="130" @if($page->sort == '130') selected @endif>130</option> | ||
125 | <option value="140" @if($page->sort == '140') selected @endif>140</option> | ||
126 | <option value="150" @if($page->sort == '150') selected @endif>150</option> | ||
127 | <option value="160" @if($page->sort == '160') selected @endif>160</option> | ||
128 | <option value="170" @if($page->sort == '170') selected @endif>170</option> | ||
129 | <option value="180" @if($page->sort == '180') selected @endif>180</option> | ||
130 | <option value="190" @if($page->sort == '190') selected @endif>190</option> | ||
131 | <option value="200" @if($page->sort == '200') selected @endif>200</option> | ||
132 | </select> | ||
133 | </td> | ||
134 | |||
74 | <td class="px-4 py-3"> | 135 | <td class="px-4 py-3"> |
75 | {{$page->created_at}} | 136 | {{$page->created_at}} |
76 | </td> | 137 | </td> |
77 | <td class="px-4 py-3 text-sm_"> | 138 | <td class="px-4 py-3 text-sm_"> |
139 | <? /*?> | ||
78 | <form action="{{ route('admin.delete-seo', ['page' => $page->id]) }}" method="POST"> | 140 | <form action="{{ route('admin.delete-seo', ['page' => $page->id]) }}" method="POST"> |
79 | <a href="{{ route('admin.edit-seo', ['page' => $page->id]) }}">Изменить</a> | | 141 | <a href="{{ route('admin.edit-seo', ['page' => $page->id]) }}">Изменить</a> | |
80 | @csrf | 142 | @csrf |
81 | @method('DELETE') | 143 | @method('DELETE') |
82 | <input class="btn btn-danger" type="submit" value="Удалить"/> | 144 | <input class="btn btn-danger" type="submit" value="Удалить"/> |
83 | </form> | 145 | </form> |
146 | <? */ ?> | ||
84 | </td> | 147 | </td> |
85 | </tr> | 148 | </tr> |
86 | @endforeach | 149 | @endforeach |
87 | </tbody> | 150 | </tbody> |
88 | </table> | 151 | </table> |
89 | </div> | 152 | </div> |
90 | 153 | ||
91 | <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"> | 154 | <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"> |
92 | <?=$header_footer->appends($_GET)->links('admin.pagginate'); ?> | 155 | <?=$header_footer->appends($_GET)->links('admin.pagginate'); ?> |
93 | </div> | 156 | </div> |
94 | </div> | 157 | </div> |
95 | @endsection | 158 | @endsection |
96 | 159 |
resources/views/admin/editbloks/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 | <th class="px-4 py-3">Редактировать</th> | ||
14 | </tr> | ||
15 | </thead> | ||
16 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | ||
17 | @foreach($header_footer as $page) | ||
18 | <tr class="text-gray-700 dark:text-gray-400"> | ||
19 | <td class="px-4 py-3"> | ||
20 | {{$page->id}} | ||
21 | </td> | ||
22 | <td class="px-4 py-3"> | ||
23 | {{$page->name}} | ||
24 | </td> | ||
25 | <td class="px-4 py-3"> | ||
26 | {{$page->link}} | ||
27 | </td> | ||
28 | <td class="px-4 py-3"> | ||
29 | <select name="code_id{{$page->code_id}}" id="{{$page->id}}" data-field="code_id" class="form-control check_js"> | ||
30 | <option value="0" | ||
31 | @if($page->code_id == 0) | ||
32 | selected | ||
33 | @endif | ||
34 | >Не указано</option> | ||
35 | @isset($list_menu) | ||
36 | @foreach($list_menu as $menu) | ||
37 | <option value="{{ $menu->id }}" | ||
38 | @if($menu->id == $page->code_id) | ||
39 | selected | ||
40 | @endif | ||
41 | >{{ $menu->name }} ({{ $menu->id }})</option> | ||
42 | @endforeach | ||
43 | @endisset | ||
44 | </select> | ||
45 | </td> | ||
46 | <td class="px-4 py-3 text-sm"> | ||
47 | <select name="sort{{$page->id}}" id="{{$page->id}}" data-field="sort" class="form-control check_js"> | ||
48 | <option value="100" @if($page->sort == '100') selected @endif>100</option> | ||
49 | <option value="110" @if($page->sort == '110') selected @endif>110</option> | ||
50 | <option value="120" @if($page->sort == '120') selected @endif>120</option> | ||
51 | <option value="130" @if($page->sort == '130') selected @endif>130</option> | ||
52 | <option value="140" @if($page->sort == '140') selected @endif>140</option> | ||
53 | <option value="150" @if($page->sort == '150') selected @endif>150</option> | ||
54 | <option value="160" @if($page->sort == '160') selected @endif>160</option> | ||
55 | <option value="170" @if($page->sort == '170') selected @endif>170</option> | ||
56 | <option value="180" @if($page->sort == '180') selected @endif>180</option> | ||
57 | <option value="190" @if($page->sort == '190') selected @endif>190</option> | ||
58 | <option value="200" @if($page->sort == '200') selected @endif>200</option> | ||
59 | </select> | ||
60 | </td> | ||
61 | |||
62 | <td class="px-4 py-3"> | ||
63 | {{$page->created_at}} | ||
64 | </td> | ||
65 | <td class="px-4 py-3 text-sm_"> | ||
66 | <? /*?> | ||
67 | <form action="{{ route('admin.delete-seo', ['page' => $page->id]) }}" method="POST"> | ||
68 | <a href="{{ route('admin.edit-seo', ['page' => $page->id]) }}">Изменить</a> | | ||
69 | @csrf | ||
70 | @method('DELETE') | ||
71 | <input class="btn btn-danger" type="submit" value="Удалить"/> | ||
72 | </form> | ||
73 | <? */ ?> | ||
74 | </td> | ||
75 | </tr> | ||
76 | @endforeach | ||
77 | </tbody> | ||
78 | </table> | ||
79 | </div> | ||
80 | |||
81 | <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"> | ||
82 | <?=$header_footer->appends($_GET)->links('admin.pagginate'); ?> | ||
83 | </div> | ||
84 | |||
85 | |||
86 |
resources/views/admin/pages/form.blade.php
1 | @csrf | 1 | @csrf |
2 | 2 | ||
3 | @isset($page) | 3 | @isset($page) |
4 | @method('PUT') | 4 | @method('PUT') |
5 | @endisset | 5 | @endisset |
6 | 6 | ||
7 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | ||
8 | <script> | ||
9 | CKEDITOR.replace( 'anons'); | ||
10 | CKEDITOR.replace( 'text', { | ||
11 | filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
12 | filebrowserUploadMethod: 'form' | ||
13 | }); | ||
14 | </script> | ||
15 | <script> | 7 | <script> |
16 | function translit(word){ | 8 | function translit(word){ |
17 | var answer = ''; | 9 | var answer = ''; |
18 | var converter = { | 10 | var converter = { |
19 | 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', | 11 | 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', |
20 | 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i', | 12 | 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i', |
21 | 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', | 13 | 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', |
22 | 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', | 14 | 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', |
23 | 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', | 15 | 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', |
24 | 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '', | 16 | 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '', |
25 | 'э': 'e', 'ю': 'yu', 'я': 'ya', | 17 | 'э': 'e', 'ю': 'yu', 'я': 'ya', |
26 | 18 | ||
27 | 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', | 19 | 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', |
28 | 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I', | 20 | 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I', |
29 | 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', | 21 | 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', |
30 | 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', | 22 | 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', |
31 | 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch', | 23 | 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch', |
32 | 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '', | 24 | 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '', |
33 | 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-' | 25 | 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-' |
34 | }; | 26 | }; |
35 | 27 | ||
36 | for (var i = 0; i < word.length; ++i ) { | 28 | for (var i = 0; i < word.length; ++i ) { |
37 | if (converter[word[i]] == undefined){ | 29 | if (converter[word[i]] == undefined){ |
38 | answer += word[i]; | 30 | answer += word[i]; |
39 | } else { | 31 | } else { |
40 | answer += converter[word[i]]; | 32 | answer += converter[word[i]]; |
41 | } | 33 | } |
42 | } | 34 | } |
43 | 35 | ||
44 | return answer; | 36 | return answer; |
45 | } | 37 | } |
46 | 38 | ||
47 | window.addEventListener("DOMContentLoaded", (event) => { | 39 | window.addEventListener("DOMContentLoaded", (event) => { |
48 | let title = document.querySelector('#name'); | 40 | let title = document.querySelector('#name'); |
49 | let text = document.querySelector('#slug'); | 41 | let text = document.querySelector('#slug'); |
50 | 42 | ||
51 | title.addEventListener('input', function() { | 43 | title.addEventListener('input', function() { |
52 | text.value = translit(this.value); | 44 | text.value = translit(this.value); |
53 | }); | 45 | }); |
54 | }); | 46 | }); |
55 | 47 | ||
56 | </script> | 48 | </script> |
57 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> | 49 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> |
58 | |||
59 | <label class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> | ||
60 | <label class="block text-sm"> | 50 | <label class="block text-sm"> |
61 | <span class="text-gray-700 dark:text-gray-400">Название страницы</span> | 51 | <span class="text-gray-700 dark:text-gray-400">Название страницы</span> |
62 | <input name="name" id="name" | 52 | <input name="name" id="name" |
63 | 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 | 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" |
64 | placeholder="Имя категории" value="{{ old('name') ?? $page->name ?? '' }}" | 54 | placeholder="Имя категории" value="{{ old('name') ?? $page->name ?? '' }}" |
65 | /> | 55 | /> |
66 | @error('name') | 56 | @error('name') |
67 | <span class="text-xs text-red-600 dark:text-red-400"> | 57 | <span class="text-xs text-red-600 dark:text-red-400"> |
68 | {{ $message }} | 58 | {{ $message }} |
69 | </span> | 59 | </span> |
70 | @enderror | 60 | @enderror |
71 | </label><br> | 61 | </label><br> |
72 | 62 | ||
73 | <label class="block text-sm"> | 63 | <label class="block text-sm"> |
74 | <span class="text-gray-700 dark:text-gray-400">Английский псевдоним страницы</span> | 64 | <span class="text-gray-700 dark:text-gray-400">Английский псевдоним страницы</span> |
75 | <input name="slug" id="slug" | 65 | <input name="slug" id="slug" |
76 | 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 | 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" |
77 | placeholder="Имя категории" value="{{ old('slug') ?? $page->slug ?? '' }}" | 67 | placeholder="Имя категории" value="{{ old('slug') ?? $page->slug ?? '' }}" |
78 | /> | 68 | /> |
79 | @error('slug') | 69 | @error('slug') |
80 | <span class="text-xs text-red-600 dark:text-red-400"> | 70 | <span class="text-xs text-red-600 dark:text-red-400"> |
81 | {{ $message }} | 71 | {{ $message }} |
82 | </span> | 72 | </span> |
83 | @enderror | 73 | @enderror |
84 | </label><br> | 74 | </label><br> |
85 | 75 | ||
86 | <label class="block text-sm"> | 76 | <label class="block text-sm"> |
87 | <span class="text-gray-700 dark:text-gray-400">Анонс</span> | 77 | <span class="text-gray-700 dark:text-gray-400">Анонс</span> |
88 | <textarea class="form-control ckeditor" name="anons" placeholder="Анонс (html)" required | 78 | <textarea class="form-control ckeditor" name="anons" placeholder="Анонс (html)" required |
89 | rows="10">{{ old('anons') ?? $page->anons ?? '' }}</textarea> | 79 | rows="10">{{ old('anons') ?? $page->anons ?? '' }}</textarea> |
90 | @error('anons') | 80 | @error('anons') |
91 | <span class="text-xs text-red-600 dark:text-red-400"> | 81 | <span class="text-xs text-red-600 dark:text-red-400"> |
92 | {{ $message }} | 82 | {{ $message }} |
93 | </span> | 83 | </span> |
94 | @enderror | 84 | @enderror |
95 | </label><br> | 85 | </label><br> |
96 | 86 | ||
97 | <label class="block text-sm"> | 87 | <label class="block text-sm"> |
98 | <span class="text-gray-700 dark:text-gray-400">Текст</span> | 88 | <span class="text-gray-700 dark:text-gray-400">Текст</span> |
99 | <textarea class="form-control ckeditor" name="text" placeholder="Текст (html)" required | 89 | <textarea class="form-control ckeditor" name="text" placeholder="Текст (html)" required |
100 | rows="10">{{ old('text') ?? $page->text ?? '' }}</textarea> | 90 | rows="10">{{ old('text') ?? $page->text ?? '' }}</textarea> |
101 | @error('text') | 91 | @error('text') |
102 | <span class="text-xs text-red-600 dark:text-red-400"> | 92 | <span class="text-xs text-red-600 dark:text-red-400"> |
103 | {{ $message }} | 93 | {{ $message }} |
104 | </span> | 94 | </span> |
105 | @enderror | 95 | @enderror |
106 | </label><br> | 96 | </label><br> |
107 | 97 | ||
108 | <label class="block text-sm"> | 98 | <label class="block text-sm"> |
109 | <span class="text-gray-700 dark:text-gray-400">Автор</span> | 99 | <span class="text-gray-700 dark:text-gray-400">Автор</span> |
110 | <input name="author" id="author" | 100 | <input name="author" id="author" |
111 | 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" | 101 | 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" |
112 | placeholder="Имя категории" value="{{ old('author') ?? $page->author ?? '' }}" | 102 | placeholder="Имя категории" value="{{ old('author') ?? $page->author ?? '' }}" |
113 | /> | 103 | /> |
114 | @error('author') | 104 | @error('author') |
115 | <span class="text-xs text-red-600 dark:text-red-400"> | 105 | <span class="text-xs text-red-600 dark:text-red-400"> |
116 | {{ $message }} | 106 | {{ $message }} |
117 | </span> | 107 | </span> |
118 | @enderror | 108 | @enderror |
119 | </label><br> | 109 | </label><br> |
120 | 110 | ||
121 | <label class="block text-sm"> | 111 | <label class="block text-sm"> |
122 | <span class="text-gray-700 dark:text-gray-400">Картинка</span> | 112 | <span class="text-gray-700 dark:text-gray-400">Картинка</span> |
123 | <input type="file" 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" id="image" name="image" accept="image/png, image/jpeg"> | 113 | <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 |
114 | focus:border-purple-400 focus:outline-none focus:shadow-outline-purple | ||
115 | dark:text-gray-300 dark:focus:shadow-outline-gray form-input" | ||
116 | id="image" name="image" accept="image/png, image/jpeg"> | ||
117 | @error('image') | ||
118 | <span class="text-xs text-red-600 dark:text-red-400"> | ||
119 | {{ $message }} | ||
120 | </span> | ||
121 | @enderror | ||
122 | @isset($page->image) | ||
123 | <img src="{{asset(Storage::url($page->image))}}" width="100px"/> | ||
124 | @endisset | ||
124 | </label><br> | 125 | </label><br> |
125 | 126 | ||
126 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | 127 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> |
127 | <div> | 128 | <div> |
128 | <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"> | 129 | <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"> |
129 | Сохранить | 130 | Сохранить |
130 | </button> | 131 | </button> |
131 | </div> | 132 | </div> |
132 | </div> | 133 | </div> |
133 | </div> | 134 | </div> |
resources/views/admin/reclames/add.blade.php
File was created | 1 | @extends('layout.admin', ['title' => 'Админка - Добавление рекламы']) | |
2 | |||
3 | @section('content') | ||
4 | <form method="POST" action="{{ route('admin.add-reclames-store') }}" enctype="multipart/form-data"> | ||
5 | @include('admin.reclames.form') | ||
6 | </form> | ||
7 | @endsection | ||
8 |
resources/views/admin/reclames/edit.blade.php
File was created | 1 | @extends('layout.admin', ['title' => 'Админка - Редактирование рекламы']) | |
2 | |||
3 | @section('content') | ||
4 | <form method="POST" action="{{ route('admin.update-reclames', ['reclame' => $reclame->id]) }}" enctype="multipart/form-data"> | ||
5 | @include('admin.reclames.form') | ||
6 | </form> | ||
7 | @endsection | ||
8 |
resources/views/admin/reclames/form.blade.php
File was created | 1 | @csrf | |
2 | |||
3 | @isset($reclame) | ||
4 | @method('PUT') | ||
5 | @endisset | ||
6 | |||
7 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | ||
8 | <script> | ||
9 | CKEDITOR.replace( 'text', { | ||
10 | filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
11 | filebrowserUploadMethod: 'form' | ||
12 | }); | ||
13 | </script> | ||
14 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> | ||
15 | <label class="block text-sm"> | ||
16 | <span class="text-gray-700 dark:text-gray-400">Заголовок рекламы</span> | ||
17 | <input name="title" id="title" | ||
18 | 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" | ||
19 | placeholder="Заголовок рекламы" value="{{ old('title') ?? $reclame->title ?? '' }}" | ||
20 | /> | ||
21 | @error('title') | ||
22 | <span class="text-xs text-red-600 dark:text-red-400"> | ||
23 | {{ $message }} | ||
24 | </span> | ||
25 | @enderror | ||
26 | </label><br> | ||
27 | |||
28 | <label class="block text-sm"> | ||
29 | <span class="text-gray-700 dark:text-gray-400"> | ||
30 | <input type="hidden" name="is_hidden" value="0" /> | ||
31 | <input type="checkbox" value="1" name="is_hidden" id="is_hidden" {{ ($reclame->is_hidden) ? "checked" : "" }} /> | ||
32 | Скрыть рекламу</span> | ||
33 | </label><br> | ||
34 | |||
35 | <label class="block text-sm"> | ||
36 | <span class="text-gray-700 dark:text-gray-400">Ссылка</span> | ||
37 | <input name="link" id="link" | ||
38 | 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" | ||
39 | placeholder="Ссылка" value="{{ old('link') ?? $reclame->link ?? '' }}" | ||
40 | /> | ||
41 | @error('link') | ||
42 | <span class="text-xs text-red-600 dark:text-red-400"> | ||
43 | {{ $message }} | ||
44 | </span> | ||
45 | @enderror | ||
46 | </label><br> | ||
47 | |||
48 | <label class="block text-sm"> | ||
49 | <span class="text-gray-700 dark:text-gray-400">Текст</span> | ||
50 | <textarea class="form-control ckeditor" name="text" id="text" placeholder="Текст (html)" required | ||
51 | rows="10">{{ old('text') ?? $reclame->text ?? '' }}</textarea> | ||
52 | @error('text') | ||
53 | <span class="text-xs text-red-600 dark:text-red-400"> | ||
54 | {{ $message }} | ||
55 | </span> | ||
56 | @enderror | ||
57 | </label><br> | ||
58 | |||
59 | <label class="block text-sm"> | ||
60 | <span class="text-gray-700 dark:text-gray-400">Позиция (число)</span> | ||
61 | <input name="position" id="position" | ||
62 | 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" | ||
63 | placeholder="Позиция" value="{{ old('position') ?? $reclame->position ?? '' }}" | ||
64 | /> | ||
65 | @error('position') | ||
66 | <span class="text-xs text-red-600 dark:text-red-400"> | ||
67 | {{ $message }} | ||
68 | </span> | ||
69 | @enderror | ||
70 | </label><br> | ||
71 | |||
72 | <label class="block text-sm"> | ||
73 | <span class="text-gray-700 dark:text-gray-400">Картинка</span> | ||
74 | <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 | ||
75 | dark:bg-gray-700 focus:border-purple-400 | ||
76 | focus:outline-none focus:shadow-outline-purple | ||
77 | dark:text-gray-300 dark:focus:shadow-outline-gray | ||
78 | form-input" | ||
79 | id="image" name="image" accept="image/png, image/jpeg"> | ||
80 | @error('image') | ||
81 | <span class="text-xs text-red-600 dark:text-red-400"> | ||
82 | {{ $message }} | ||
83 | </span> | ||
84 | @enderror | ||
85 | @isset($reclame->image) | ||
86 | <img src="{{asset(Storage::url($reclame->image))}}" width="100px"/> | ||
87 | @endisset | ||
88 | |||
89 | </label><br> | ||
90 | |||
91 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | ||
92 | <div> | ||
93 | <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"> | ||
94 | Сохранить | ||
95 | </button> | ||
96 | </div> | ||
97 | </div> | ||
98 | </div> | ||
99 |
resources/views/admin/reclames/index.blade.php
1 | @extends('layout.admin', ['title' => 'Админка - Реклама сайта']) | 1 | @extends('layout.admin', ['title' => 'Админка - Реклама сайта']) |
2 | 2 | ||
3 | @section('script') | 3 | @section('script') |
4 | 4 | ||
5 | @endsection | 5 | @endsection |
6 | 6 | ||
7 | @section('search') | 7 | @section('search') |
8 | <!--<div class="absolute inset-y-0 flex items-center pl-2"> | 8 | <!--<div class="absolute inset-y-0 flex items-center pl-2"> |
9 | <svg | 9 | <svg |
10 | class="w-4 h-4" | 10 | class="w-4 h-4" |
11 | aria-hidden="true" | 11 | aria-hidden="true" |
12 | fill="currentColor" | 12 | fill="currentColor" |
13 | viewBox="0 0 20 20" | 13 | viewBox="0 0 20 20" |
14 | > | 14 | > |
15 | <path | 15 | <path |
16 | fill-rule="evenodd" | 16 | fill-rule="evenodd" |
17 | 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" | 17 | 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" |
18 | clip-rule="evenodd" | 18 | clip-rule="evenodd" |
19 | ></path> | 19 | ></path> |
20 | </svg> | 20 | </svg> |
21 | </div> | 21 | </div> |
22 | <form action="" method="POST"> | 22 | <form action="" method="POST"> |
23 | <div style="float:left;"><input | 23 | <div style="float:left;"><input |
24 | 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" | 24 | 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" |
25 | style="width: 400px" | 25 | style="width: 400px" |
26 | type="text" | 26 | type="text" |
27 | placeholder="Искать..." | 27 | placeholder="Искать..." |
28 | aria-label="Search" | 28 | aria-label="Search" |
29 | /></div> | 29 | /></div> |
30 | <div style="float: left"> | 30 | <div style="float: left"> |
31 | <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> | 31 | <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> |
32 | </div> | 32 | </div> |
33 | </form>--> | 33 | </form>--> |
34 | @endsection | 34 | @endsection |
35 | 35 | ||
36 | @section('content') | 36 | @section('content') |
37 | 37 | ||
38 | <a href="{{ route('admin.add-seo') }}" style="width: 160px" 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"> | 38 | <a href="{{ route('admin.add-reclames') }}" style="width: 160px" 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"> |
39 | Добавить рекламу | 39 | Добавить рекламу |
40 | </a> | 40 | </a> |
41 | <br> | 41 | <br> |
42 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | 42 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
43 | 43 | ||
44 | <div class="w-full overflow-x-auto"> | 44 | <div class="w-full overflow-x-auto"> |
45 | <table class="w-full whitespace-no-wrap"> | 45 | <table class="w-full whitespace-no-wrap"> |
46 | <thead> | 46 | <thead> |
47 | <tr | 47 | <tr |
48 | 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" | 48 | 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" |
49 | > | 49 | > |
50 | <th class="px-4 py-3">№</th> | 50 | <th class="px-4 py-3">№</th> |
51 | <th class="px-4 py-3">Заголовок</th> | 51 | <th class="px-4 py-3">Заголовок</th> |
52 | <th class="px-4 py-3">Ссылка</th> | 52 | <th class="px-4 py-3">Ссылка</th> |
53 | <th class="px-4 py-3">Позиция</th> | 53 | <th class="px-4 py-3">Позиция</th> |
54 | <th class="px-4 py-3">Скрыть</th> | 54 | <th class="px-4 py-3">Скрыть</th> |
55 | <th class="px-4 py-3">Клики</th> | 55 | <th class="px-4 py-3">Клики</th> |
56 | <th class="px-4 py-3">Редактировать</th> | 56 | <th class="px-4 py-3">Редактировать</th> |
57 | </tr> | 57 | </tr> |
58 | </thead> | 58 | </thead> |
59 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | 59 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
60 | @foreach($reclames as $reclame) | 60 | @foreach($reclames as $reclame) |
61 | <tr class="text-gray-700 dark:text-gray-400"> | 61 | <tr class="text-gray-700 dark:text-gray-400"> |
62 | <td class="px-4 py-3"> | 62 | <td class="px-4 py-3"> |
63 | {{$reclame->id}} | 63 | {{$reclame->id}} |
64 | </td> | 64 | </td> |
65 | <td class="px-4 py-3"> | 65 | <td class="px-4 py-3"> |
66 | {{$reclame->title}} | 66 | {{$reclame->title}} |
67 | </td> | 67 | </td> |
68 | <td class="px-4 py-3"> | 68 | <td class="px-4 py-3"> |
69 | {{$reclame->link}} | 69 | {{$reclame->link}} |
70 | </td> | 70 | </td> |
71 | <td class="px-4 py-3"> | 71 | <td class="px-4 py-3"> |
72 | {{$reclame->position}} | 72 | {{$reclame->position}} |
73 | </td> | 73 | </td> |
74 | <td class="px-4 py-3"> | 74 | <td class="px-4 py-3"> |
75 | {{$reclame->is_hidden}} | 75 | @if ($reclame->is_hidden) |
76 | Скрыто | ||
77 | @else | ||
78 | Показано | ||
79 | @endif | ||
76 | </td> | 80 | </td> |
77 | <td class="px-4 py-3"> | 81 | <td class="px-4 py-3"> |
78 | {{$reclame->col_vo_click}} | 82 | {{$reclame->col_vo_click}} |
79 | </td> | 83 | </td> |
80 | <td class="px-4 py-3 text-sm_"> | 84 | <td class="px-4 py-3 text-sm_"> |
81 | <form action="{{ route('admin.delete-seo', ['page' => $reclame->id]) }}" method="POST"> | 85 | <form action="{{ route('admin.delete-reclames', ['reclame' => $reclame->id]) }}" method="POST"> |
82 | <a href="{{ route('admin.edit-seo', ['page' => $reclame->id]) }}">Изменить</a> | | 86 | <a href="{{ route('admin.edit-reclames', ['reclame' => $reclame->id]) }}">Изменить</a> | |
83 | @csrf | 87 | @csrf |
84 | @method('DELETE') | 88 | @method('DELETE') |
85 | <input class="btn btn-danger" type="submit" value="Удалить"/> | 89 | <input class="btn btn-danger" type="submit" value="Удалить"/> |
86 | </form> | 90 | </form> |
87 | </td> | 91 | </td> |
88 | </tr> | 92 | </tr> |
89 | @endforeach | 93 | @endforeach |
90 | </tbody> | 94 | </tbody> |
91 | </table> | 95 | </table> |
92 | </div> | 96 | </div> |
93 | 97 | ||
94 | <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"> | 98 | <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"> |
95 | <?=$reclames->appends($_GET)->links('admin.pagginate'); ?> | 99 | <?=$reclames->appends($_GET)->links('admin.pagginate'); ?> |
96 | </div> | 100 | </div> |
97 | </div> | 101 | </div> |
98 | @endsection | 102 | @endsection |
99 | 103 |
routes/web.php
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\InfoBloksController; | 6 | use App\Http\Controllers\Admin\InfoBloksController; |
7 | use App\Http\Controllers\Admin\JobTitlesController; | 7 | use App\Http\Controllers\Admin\JobTitlesController; |
8 | use App\Http\Controllers\Admin\UsersController; | 8 | use App\Http\Controllers\Admin\UsersController; |
9 | use App\Http\Controllers\Admin\WorkersController; | 9 | use App\Http\Controllers\Admin\WorkersController; |
10 | use App\Http\Controllers\Auth\LoginController; | 10 | use App\Http\Controllers\Auth\LoginController; |
11 | use App\Http\Controllers\Auth\RegisterController; | 11 | use App\Http\Controllers\Auth\RegisterController; |
12 | use App\Http\Controllers\CKEditorController; | 12 | use App\Http\Controllers\CKEditorController; |
13 | use App\Models\User; | 13 | use App\Models\User; |
14 | use App\Http\Controllers\MainController; | 14 | use App\Http\Controllers\MainController; |
15 | use App\Http\Controllers\HomeController; | 15 | use App\Http\Controllers\HomeController; |
16 | use Illuminate\Support\Facades\Route; | 16 | use Illuminate\Support\Facades\Route; |
17 | use App\Http\Controllers\Admin\CompanyController; | 17 | use App\Http\Controllers\Admin\CompanyController; |
18 | use App\Http\Controllers\Admin\Ad_EmployersController; | 18 | use App\Http\Controllers\Admin\Ad_EmployersController; |
19 | use App\Http\Controllers\Admin\MsgAnswersController; | 19 | use App\Http\Controllers\Admin\MsgAnswersController; |
20 | use App\Http\Controllers\Admin\GroupsController; | 20 | use App\Http\Controllers\Admin\GroupsController; |
21 | use App\Http\Controllers\PagesController; | 21 | use App\Http\Controllers\PagesController; |
22 | 22 | ||
23 | 23 | ||
24 | /* | 24 | /* |
25 | |-------------------------------------------------------------------------- | 25 | |-------------------------------------------------------------------------- |
26 | | Web Routes | 26 | | Web Routes |
27 | |-------------------------------------------------------------------------- | 27 | |-------------------------------------------------------------------------- |
28 | | | 28 | | |
29 | | Here is where you can register web routes for your application. These | 29 | | Here is where you can register web routes for your application. These |
30 | | routes are loaded by the RouteServiceProvider within a group which | 30 | | routes are loaded by the RouteServiceProvider within a group which |
31 | | contains the "web" middleware group. Now create something great! | 31 | | contains the "web" middleware group. Now create something great! |
32 | | | 32 | | |
33 | */ | 33 | */ |
34 | /* | 34 | /* |
35 | Route::get('/', function () { | 35 | Route::get('/', function () { |
36 | return view('welcome'); | 36 | return view('welcome'); |
37 | })->name('index'); | 37 | })->name('index'); |
38 | */ | 38 | */ |
39 | Route::get('/', [MainController::class, 'index'])->name('index'); | 39 | Route::get('/', [MainController::class, 'index'])->name('index'); |
40 | 40 | ||
41 | //Роуты авторизации, регистрации, восстановления, аутентификации | 41 | //Роуты авторизации, регистрации, восстановления, аутентификации |
42 | Auth::routes(['verify' => true]); | 42 | Auth::routes(['verify' => true]); |
43 | //Личный кабинет пользователя | 43 | //Личный кабинет пользователя |
44 | Route::get('/home', [HomeController::class, 'index'])->name('home'); | 44 | Route::get('/home', [HomeController::class, 'index'])->name('home'); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { | 47 | Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { |
48 | $user = User::where('email',$request->input('email'))->first(); | 48 | $user = User::where('email',$request->input('email'))->first(); |
49 | 49 | ||
50 | $user->sendEmailVerificationNotification(); | 50 | $user->sendEmailVerificationNotification(); |
51 | 51 | ||
52 | return 'your response'; | 52 | return 'your response'; |
53 | })->middleware('throttle:6,1')->name('verification.resend'); | 53 | })->middleware('throttle:6,1')->name('verification.resend'); |
54 | */ | 54 | */ |
55 | 55 | ||
56 | // Авторизация, регистрация в админку | 56 | // Авторизация, регистрация в админку |
57 | Route::group([ | 57 | Route::group([ |
58 | 'as' => 'admin.', // имя маршрута, например auth.index | 58 | 'as' => 'admin.', // имя маршрута, например auth.index |
59 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 59 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
60 | 'middleware' => ['guest'], | 60 | 'middleware' => ['guest'], |
61 | ], function () { | 61 | ], function () { |
62 | // Форма регистрации | 62 | // Форма регистрации |
63 | Route::get('register', [AdminController::class, 'register'])->name('register'); | 63 | Route::get('register', [AdminController::class, 'register'])->name('register'); |
64 | 64 | ||
65 | // Создание пользователя | 65 | // Создание пользователя |
66 | Route::post('register', [AdminController::class, 'create'])->name('create'); | 66 | Route::post('register', [AdminController::class, 'create'])->name('create'); |
67 | //Форма входа | 67 | //Форма входа |
68 | Route::get('login', [AdminController::class, 'login'])->name('login'); | 68 | Route::get('login', [AdminController::class, 'login'])->name('login'); |
69 | 69 | ||
70 | // аутентификация | 70 | // аутентификация |
71 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); | 71 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); |
72 | 72 | ||
73 | }); | 73 | }); |
74 | 74 | ||
75 | // Личный кабинет админки | 75 | // Личный кабинет админки |
76 | Route::group([ | 76 | Route::group([ |
77 | 'as' => 'admin.', // имя маршрута, например auth.index | 77 | 'as' => 'admin.', // имя маршрута, например auth.index |
78 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 78 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
79 | 'middleware' => ['auth'], ['admin'], | 79 | 'middleware' => ['auth'], ['admin'], |
80 | ], function() { | 80 | ], function() { |
81 | 81 | ||
82 | // выход | 82 | // выход |
83 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); | 83 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); |
84 | 84 | ||
85 | // кабинет главная страница | 85 | // кабинет главная страница |
86 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); | 86 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); |
87 | 87 | ||
88 | // кабинет профиль админа - форма | 88 | // кабинет профиль админа - форма |
89 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); | 89 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); |
90 | // кабинет профиль админа - сохранение формы | 90 | // кабинет профиль админа - сохранение формы |
91 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); | 91 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); |
92 | 92 | ||
93 | // кабинет профиль - форма пароли | 93 | // кабинет профиль - форма пароли |
94 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); | 94 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); |
95 | // кабинет профиль - сохранение формы пароля | 95 | // кабинет профиль - сохранение формы пароля |
96 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); | 96 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); |
97 | 97 | ||
98 | 98 | ||
99 | // кабинет профиль пользователя - форма | 99 | // кабинет профиль пользователя - форма |
100 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); | 100 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); |
101 | // кабинет профиль пользователя - сохранение формы | 101 | // кабинет профиль пользователя - сохранение формы |
102 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); | 102 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); |
103 | 103 | ||
104 | // кабинет профиль работодатель - форма | 104 | // кабинет профиль работодатель - форма |
105 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); | 105 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); |
106 | // кабинет профиль работодатель - сохранение формы | 106 | // кабинет профиль работодатель - сохранение формы |
107 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); | 107 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); |
108 | 108 | ||
109 | // кабинет профиль работник - форма | 109 | // кабинет профиль работник - форма |
110 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile'); | 110 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile'); |
111 | 111 | ||
112 | // кабинет настройки сайта - форма | 112 | // кабинет настройки сайта - форма |
113 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); | 113 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); |
114 | // кабинет настройки сайта сохранение формы | 114 | // кабинет настройки сайта сохранение формы |
115 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); | 115 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); |
116 | 116 | ||
117 | // кабинет - пользователи | 117 | // кабинет - пользователи |
118 | Route::get('users', [UsersController::class, 'index'])->name('users'); | 118 | Route::get('users', [UsersController::class, 'index'])->name('users'); |
119 | 119 | ||
120 | // кабинет - пользователи | 120 | // кабинет - пользователи |
121 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); | 121 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); |
122 | 122 | ||
123 | // кабинет - работодатели | 123 | // кабинет - работодатели |
124 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); | 124 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); |
125 | 125 | ||
126 | // кабинет - соискатели | 126 | // кабинет - соискатели |
127 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); | 127 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); |
128 | 128 | ||
129 | // кабинет - вакансии | 129 | // кабинет - вакансии |
130 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); | 130 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); |
131 | 131 | ||
132 | // кабинет - категории | 132 | // кабинет - категории |
133 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); | 133 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); |
134 | /* | 134 | /* |
135 | * CRUD-операции над Справочником Категории | 135 | * CRUD-операции над Справочником Категории |
136 | */ | 136 | */ |
137 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); | 137 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); |
138 | 138 | ||
139 | 139 | ||
140 | //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); | 140 | //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); |
141 | /* | 141 | /* |
142 | * кабинет - CRUD-операции по справочнику должности | 142 | * кабинет - CRUD-операции по справочнику должности |
143 | * | 143 | * |
144 | */ | 144 | */ |
145 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); | 145 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); |
146 | 146 | ||
147 | // кабинет - сообщения | 147 | // кабинет - сообщения |
148 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); | 148 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); |
149 | 149 | ||
150 | /* | 150 | /* |
151 | * Расписанный подход в описании каждой директорий групп пользователей. | 151 | * Расписанный подход в описании каждой директорий групп пользователей. |
152 | */ | 152 | */ |
153 | // кабинет - группы пользователей | 153 | // кабинет - группы пользователей |
154 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); | 154 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); |
155 | // кабинет - добавление форма группы пользователей | 155 | // кабинет - добавление форма группы пользователей |
156 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); | 156 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); |
157 | // кабинет - сохранение формы группы пользователей | 157 | // кабинет - сохранение формы группы пользователей |
158 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); | 158 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); |
159 | // кабинет - редактирование форма группы пользователей | 159 | // кабинет - редактирование форма группы пользователей |
160 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); | 160 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); |
161 | // кабинет - сохранение редактированной формы группы пользователей | 161 | // кабинет - сохранение редактированной формы группы пользователей |
162 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); | 162 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); |
163 | // кабинет - удаление группы пользователей | 163 | // кабинет - удаление группы пользователей |
164 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); | 164 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); |
165 | 165 | ||
166 | // кабинет - список админов | 166 | // кабинет - список админов |
167 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); | 167 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); |
168 | 168 | ||
169 | /////редактор////// кабинет - редактор сайта//////////////////////// | 169 | /////редактор////// кабинет - редактор сайта//////////////////////// |
170 | Route::get('editor-site', function() { | 170 | Route::get('editor-site', function() { |
171 | return view('admin.editor.index'); | 171 | return view('admin.editor.index'); |
172 | })->name('editor-site'); | 172 | })->name('editor-site'); |
173 | 173 | ||
174 | // кабинет - редактор шапки-футера сайта | 174 | // кабинет - редактор шапки-футера сайта |
175 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); | 175 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); |
176 | 176 | ||
177 | // кабинет - редактор должности на главной | 177 | // кабинет - редактор должности на главной |
178 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); | 178 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); |
179 | 179 | ||
180 | // кабинет - редактор работодатели на главной | 180 | // кабинет - редактор работодатели на главной |
181 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); | 181 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); |
182 | 182 | ||
183 | |||
183 | // кабинет - редактор seo-сайта | 184 | // кабинет - редактор seo-сайта |
184 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); | 185 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); |
185 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); | 186 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); |
186 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); | 187 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); |
187 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); | 188 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); |
188 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); | 189 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); |
189 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); | 190 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); |
190 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); | 191 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); |
191 | 192 | ||
192 | 193 | ||
193 | // кабинет - редактор страниц | 194 | // кабинет - редактор страниц |
194 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); | 195 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); |
195 | // кабинет - добавление страницы | 196 | // кабинет - добавление страницы |
196 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); | 197 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); |
197 | // кабинет - сохранение формы страницы | 198 | // кабинет - сохранение формы страницы |
198 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); | 199 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); |
199 | // кабинет - редактирование форма страницы | 200 | // кабинет - редактирование форма страницы |
200 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); | 201 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); |
201 | // кабинет - сохранение редактированной формы страницы | 202 | // кабинет - сохранение редактированной формы страницы |
202 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); | 203 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); |
203 | // кабинет - удаление страницы | 204 | // кабинет - удаление страницы |
204 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); | 205 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); |
205 | 206 | ||
206 | 207 | ||
207 | // кабинет - реклама сайта | 208 | // кабинет - реклама сайта |
208 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); | 209 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); |
210 | Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); | ||
211 | Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); | ||
212 | Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); | ||
213 | Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); | ||
214 | Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); | ||
209 | //////////////////////////////////////////////////////////////////////// | 215 | //////////////////////////////////////////////////////////////////////// |
210 | 216 | ||
217 | |||
211 | // кабинет - отзывы о работодателе для модерации | 218 | // кабинет - отзывы о работодателе для модерации |
212 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); | 219 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); |
213 | 220 | ||
214 | // Общая страница статистики | 221 | // Общая страница статистики |
215 | Route::get('statics', function () { | 222 | Route::get('statics', function () { |
216 | return view('admin.static.index'); | 223 | return view('admin.static.index'); |
217 | })->name('statics'); | 224 | })->name('statics'); |
218 | 225 | ||
219 | // кабинет - статистика работников | 226 | // кабинет - статистика работников |
220 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); | 227 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); |
221 | 228 | ||
222 | // кабинет - статистика вакансий работодателя | 229 | // кабинет - статистика вакансий работодателя |
223 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); | 230 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); |
224 | 231 | ||
225 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника | 232 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника |
226 | /* | 233 | /* |
227 | * CRUD-операции над справочником дипломы и документы | 234 | * CRUD-операции над справочником дипломы и документы |
228 | */ | 235 | */ |
229 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); | 236 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); |
230 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); | 237 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); |
231 | 238 | ||
232 | // кабинет - роли пользователя | 239 | // кабинет - роли пользователя |
233 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); | 240 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); |
234 | 241 | ||
235 | }); | 242 | }); |
236 | 243 | ||
237 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); | 244 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); |
238 | 245 | ||
239 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); | 246 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); |
240 | 247 |