Commit 5b2dcf44bcbc4104982dafd29e39da7190924e3b

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

Редактор страниц и SEO, CKEditorContoller, CompanyController

Showing 18 changed files with 788 additions and 22 deletions Inline Diff

app/Classes/Meta.php
File was created 1 <?php
2
3
4 namespace App\Classes;
5
6
7 class Meta
8 {
9 private static $STATUS = array(
10 "initialized"=>0,
11 "success"=>1,
12 "fail"=>2
13 );
14 private $metaData;
15 private $url;
16 private $html;
17 private $status;
18 private $meta;
19
20 /**
21 * __construct
22 *
23 * Require the url of the webpage for meta data extraction
24 *
25 * @access public
26 * @param string $url
27 */
28 public function __construct($url) {
29 $this->url = $url;
30 $this->metaData = new \StdClass;
31 $this->metaData->title = "";
32 $this->metaData->description = "";
33 $this->metaData->keywords = "";
34 $this->metaData->image = "";
35 $this->initialized();
36 }
37
38 /**
39 * parse
40 *
41 * Parse the meta data from the given url and populate data member $metaData
42 *
43 * @access public
44 * @return integer
45 */
46 public function parse() {
47 // load HTML as DOMDocument object for parsing
48 $this->html = new \DOMDocument;
49 libxml_use_internal_errors(true);
50 $this->html->loadHTML(file_get_contents($this->url));
51
52 // php built-in get_meta_tags() only read those with name "title", "description" and so on
53 // so I wrote my own version supporting twitter:title, og:title, etc.
54 $this->meta = $this->my_get_meta_tags($this->url);
55
56 $this->success(); // assume successful
57
58 // possible to add more method such as getAuthor()
59 $this->getTitle();
60 $this->getDescription();
61 $this->getKeywords();
62 $this->getImage();
63
64 return $this->status;
65 }
66
67
68 /**
69 * finalize
70 *
71 * Export the meta data parsed
72 *
73 * @access public
74 * @return StdClass
75 */
76 public function finalize() {
77 $tmp = new \StdClass;
78 $tmp->url = $this->url;
79 $tmp->title = $this->metaData->title;
80 $tmp->description = $this->metaData->description;
81 $tmp->image = $this->metaData->image;
82 $tmp->status = $this->status;
83 $tmp->keywords = $this->metaData->keywords;
84 return $tmp;
85 }
86
87 /**
88 * my_get_meta_tags
89 *
90 * Require the url to be parsed, read every meta tags found
91 *
92 * @access private
93 * @param string $url
94 * @return array
95 */
96 private function my_get_meta_tags($url) {
97 $metatags = $this->html->getElementsByTagName("meta");
98 $tmeta = array();
99 for ($i=0; $i<$metatags->length; ++$i) {
100 $item = $metatags->item($i);
101 $name = $item->getAttribute('name');
102
103 if (empty($name)) {
104 // og meta tags, or twitter meta tags
105 $tmeta[$item->getAttribute('property')] = $item->getAttribute('content');
106 }
107 else {
108 // conventional meta tags
109 $tmeta[$name] = $item->getAttribute('content');
110 }
111 }
112 return $tmeta;
113 }
114
115 /**
116 * initizlized
117 *
118 * Set the state of the object to be initizlied
119 *
120 * @access private
121 */
122 private function initialized() {
123 $this->status = self::$STATUS["initialized"];
124 }
125
126 /**
127 * success
128 *
129 * Set the state of the object to be successful
130 *
131 * @access private
132 */
133 private function success() {
134 $this->status = self::$STATUS["success"];
135 }
136
137 /**
138 * fail
139 *
140 * Set the state of the object to be failed
141 *
142 * @access private
143 */
144 private function fail() {
145 $this->status = self::$STATUS["fail"];
146 }
147
148 /**
149 * getTitle
150 *
151 * Read meta title based on priorities of the tag name/property,
152 * fallback to reading <title> and <h1> if meta title not present
153 *
154 * @access private
155 */
156 private function getTitle() {
157 if (isset($this->meta["og:title"])) {
158 $this->metaData->title = $this->meta["og:title"];
159 return;
160 }
161
162 if (isset($this->meta["twitter:title"])) {
163 $this->metaData->title = $this->meta["twitter:title"];
164 return;
165 }
166
167 if (isset($this->meta["title"])) {
168 $this->metaData->title = $this->meta["title"];
169 return;
170 }
171
172 $title = $this->html->getElementsByTagName("title") or $title = $this->html->getElementsByTagName("h1");
173 // taking either the title or h1 tag
174 if (!$title->length) {
175 // if no h1 tag, nothing good enough to be the site title
176 $this->fail();
177 return;
178 }
179 else {
180 $this->metaData->title = ($title->length) ? $title->item(0)->nodeValue : "";
181 }
182 }
183
184 /**
185 * getDescription
186 *
187 * Read meta description based on priorities of the tag name/property.
188 * No fallback, it doesn't read anything except for the meta tag
189 *
190 * @access private
191 */
192 private function getDescription() {
193 if (isset($this->meta["og:description"])) {
194 $this->metaData->description = $this->meta["og:description"];
195 return;
196 }
197
198 if (isset($this->meta["twitter:description"])) {
199 $this->metaData->description = $this->meta["twitter:description"];
200 return;
201 }
202
203 if (isset($this->meta["description"])) {
204 $this->metaData->description = $this->meta["description"];
205 return;
206 }
207
208 $this->fail();
209 return;
210 }
211
212
213 private function getKeywords() {
214 if (isset($this->meta["og:keywords"])) {
215 $this->metaData->keywords = $this->meta["og:keywords"];
216 return;
217 }
218
219 if (isset($this->meta["twitter:keywords"])) {
220 $this->metaData->keywords = $this->meta["twitter:description"];
221 return;
222 }
223
224 if (isset($this->meta["keywords"])) {
225 $this->metaData->keywords = $this->meta["keywords"];
226 return;
227 }
228
229 $this->fail();
230 return;
231 }
232
233
234 /**
235 * getImage
236 *
237 * Read meta image url based on priorities of the tag name/property.
238 * No fallback, it doesn't read anything except for the meta tag
239 *
240 * @access private
241 */
242 private function getImage() {
243 if (isset($this->meta["og:image"])) {
244 $this->metaData->image = $this->meta["og:image"];
245 return;
246 }
247
248 if (isset($this->meta["twitter:image"])) {
249 $this->metaData->image = $this->meta["twitter:image"];
250 return;
251 }
252
253 if (isset($this->meta["image"])) {
254 $this->metaData->image = $this->meta["image"];
255 return;
256 }
257
258 $this->fail();
259 }
260 }
261
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\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Http\Requests\PagesRequest;
7 use App\Http\Requests\SEORequest;
6 use App\Models\Employer; 8 use App\Models\Employer;
7 use App\Models\employers_main; 9 use App\Models\employers_main;
10 use App\Models\header_footer;
8 use App\Models\Job_title; 11 use App\Models\Job_title;
9 use App\Models\job_titles_main; 12 use App\Models\job_titles_main;
10 use App\Models\pages; 13 use App\Models\pages;
14 use App\Models\reclame;
15 use App\Models\SEO;
11 use Illuminate\Http\Request; 16 use Illuminate\Http\Request;
12 17
13 class CompanyController extends Controller 18 class CompanyController extends Controller
14 { 19 {
15 // кабинет - редактор сайта 20 // кабинет - редактор сайта
16 public function editor() { 21 public function editor() {
17 return; 22 return;
18 } 23 }
19 24
20 // кабинет - редактор шапки-футера сайта
21 public function editblocks() {
22 return;
23 }
24
25 // кабинет - редактор должности на главной 25 // кабинет - редактор должности на главной
26 public function job_titles_main(Request $request) { 26 public function job_titles_main(Request $request) {
27 if ($request->ajax()) { 27 if ($request->ajax()) {
28 $user = job_titles_main::find($request->id); 28 $user = job_titles_main::find($request->id);
29 $request->offsetUnset('id'); 29 $request->offsetUnset('id');
30 $user->update($request->all()); 30 $user->update($request->all());
31 } 31 }
32 32
33 $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10); 33 $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10);
34 $list_job_titles = Job_title::query()->active()->orderBy('name')->get(); 34 $list_job_titles = Job_title::query()->active()->orderBy('name')->get();
35 35
36 if ($request->ajax()) { 36 if ($request->ajax()) {
37 return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles')); 37 return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles'));
38 } else { 38 } else {
39 return view('admin.job_main.index', compact('jobs', 'list_job_titles')); 39 return view('admin.job_main.index', compact('jobs', 'list_job_titles'));
40 } 40 }
41 } 41 }
42 42
43 // кабинет - редактор шапки-футера сайта
44 public function editblocks() {
45 $header_footer = header_footer::query()->OrderBy('name')->paginate(15);
46 return view('admin.editbloks.index', compact('header_footer'));
47 }
48
43 // кабинет - редактор работодатели на главной 49 // кабинет - редактор работодатели на главной
44 public function employers_main(Request $request) { 50 public function employers_main(Request $request) {
45 if ($request->ajax()) { 51 if ($request->ajax()) {
46 $user = employers_main::find($request->id); 52 $user = employers_main::find($request->id);
47 $request->offsetUnset('id'); 53 $request->offsetUnset('id');
48 $user->update($request->all()); 54 $user->update($request->all());
49 } 55 }
50 56
51 $employers = employers_main::query()->OrderBy('sort')->paginate(10); 57 $employers = employers_main::query()->OrderBy('sort')->paginate(10);
52 $list_employers = Employer::query()->active()->orderBy('name_company')->get(); 58 $list_employers = Employer::query()->active()->orderBy('name_company')->get();
53 59
54 if ($request->ajax()) { 60 if ($request->ajax()) {
55 return view('admin.employer_main.index_ajax', compact('employers', 'list_employers')); 61 return view('admin.employer_main.index_ajax', compact('employers', 'list_employers'));
56 } else { 62 } else {
57 return view('admin.employer_main.index', compact('employers', 'list_employers')); 63 return view('admin.employer_main.index', compact('employers', 'list_employers'));
58 } 64 }
59 } 65 }
60 66
61 // кабинет - редактор seo-сайта 67 //////////// кабинет - редактор seo-сайта /////////////////////////////
62 public function editor_seo() { 68 public function editor_seo() {
63 return; 69 $pages = SEO::query()->OrderBy('url')->paginate(15);
70 return view('admin.seo.index', compact('pages'));
64 } 71 }
65 72
73 public function editor_seo_add() {
74 return view('admin.seo.add');
75 }
76
77 public function editor_seo_store(SEORequest $request) {
78 SEO::create($request->all());
79 return redirect()->route('admin.editor-seo');
80 }
81
82 public function editor_seo_edit(SEO $page) {
83 return view('admin.seo.edit', compact('page'));
84 }
85
86 public function editor_seo_update(SEORequest $request, SEO $page) {
87 $page->update($request->all());
88 return redirect()->route('admin.editor-seo');
89 }
90
91 public function editor_seo_destroy(SEO $page) {
92 $page->delete();
93 return redirect()->route('admin.editor-seo');
94 }
95 ///////////////////////////////////////////////////////////////////////
96
66 /////////// кабинет - редактор страниц //////////////////////////////// 97 /////////// кабинет - редактор страниц ////////////////////////////////
67 public function editor_pages() { 98 public function editor_pages() {
68 $pages = pages::query()->OrderBy('name')->paginate(15); 99 $pages = pages::query()->OrderBy('name')->paginate(15);
69 return view('admin.pages.index', compact('pages')); 100 return view('admin.pages.index', compact('pages'));
70 } 101 }
71 102
72 public function editor_pages_add() { 103 public function editor_pages_add() {
73 return view('admin.pages.add'); 104 return view('admin.pages.add');
74 } 105 }
75 106
76 public function editor_pages_store(Request $request) { 107 public function editor_pages_store(PagesRequest $request) {
77 return; 108 pages::create($request->all());
109 return redirect()->route('admin.editor-pages');
78 } 110 }
79 111
80 public function editor_pages_edit(pages $page) { 112 public function editor_pages_edit(pages $page) {
81 return view('admin.pages.edit', compact('page')); 113 return view('admin.pages.edit', compact('page'));
82 } 114 }
83 115
84 public function editor_pages_update(Request $request, pages $page) { 116 public function editor_pages_update(PagesRequest $request, pages $page) {
85 return; 117 $page->update($request->all());
118 return redirect()->route('admin.editor-pages');
86 } 119 }
87 120
88 public function editor_pages_destroy(pages $page) { 121 public function editor_pages_destroy(pages $page) {
89 return; 122 $page->delete();
123 return redirect()->route('admin.editor-pages');
90 } 124 }
91 /////////////////////////////////////////////////////////////////// 125 ///////////////////////////////////////////////////////////////////
92 126
93 // кабинет - реклама сайта 127 // кабинет - реклама сайта
94 public function reclames() { 128 public function reclames() {
app/Http/Controllers/CKEditorController.php
File was created 1 <?php
2
3 namespace App\Http\Controllers;
4
5 use Illuminate\Http\Request;
6
7 class CKEditorController extends Controller
8 {
9 public function upload(Request $request)
10 {
11 if($request->hasFile('upload')) {
12 $originName = $request->file('upload')->getClientOriginalName();
13 $fileName = pathinfo($originName, PATHINFO_FILENAME);
14 $extension = $request->file('upload')->getClientOriginalExtension();
15 $fileName = $fileName.'_'.time().'.'.$extension;
16 $request->file('upload')->move(public_path('images'), $fileName);
17 $CKEditorFuncNum = $request->input('CKEditorFuncNum');
18 $url = asset('images/'.$fileName);
19 $msg = 'Image successfully uploaded';
20 $response = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>";
21
22 @header('Content-type: text/html; charset=utf-8');
23 echo $response;
24 }
25 }
26 }
27
app/Http/Controllers/PagesController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Models\pages;
5 use Illuminate\Http\Request; 6 use Illuminate\Http\Request;
6 7
7 class PagesController extends Controller 8 class PagesController extends Controller
8 { 9 {
9 public function pages(string $slug) { 10 public function pages(pages $pages) {
10 return; 11 $page = pages::query()->where('slug', $pages->slug)->first();
12 print_r($page);
11 } 13 }
12 } 14 }
13 15
app/Http/Requests/PagesRequest.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Requests; 3 namespace App\Http\Requests;
4 4
5 use Illuminate\Foundation\Http\FormRequest; 5 use Illuminate\Foundation\Http\FormRequest;
6 6
7 class PagesRequest extends FormRequest 7 class PagesRequest extends FormRequest
8 { 8 {
9 /** 9 /**
10 * Determine if the user is authorized to make this request. 10 * Determine if the user is authorized to make this request.
11 * 11 *
12 * @return bool 12 * @return bool
13 */ 13 */
14 public function authorize() 14 public function authorize()
15 { 15 {
16 return false; 16 return true;
17 } 17 }
18 18
19 /** 19 /**
20 * Get the validation rules that apply to the request. 20 * Get the validation rules that apply to the request.
21 * 21 *
22 * @return array<string, mixed> 22 * @return array<string, mixed>
23 */ 23 */
24 public function rules() 24 public function rules()
25 { 25 {
26 $unique = 'unique:pages,slug';
27 if (in_array($this->route()->getName(), ['admin.update-page'])) {
28 // получаем модель Pages через маршрут admin/editor-pages/edit/{page}
29 $model = $this->route('page');
30 /*
31 * Проверка на уникальность slug, исключая этот пост по идентификатору:
32 * 1. posts - таблица базы данных, где проверяется уникальность
33 * 2. slug - имя колонки, уникальность значения которой проверяется
34 * 3. значение по которому из проверки исключается запись таблицы БД
35 * 4. поле, по которому из проверки исключается запись таблицы БД
36 * Для проверки будет использован такой SQL-запрос к базе данных:
37 * SELECT COUNT(*) FROM `pages` WHERE `slug` = '...' AND `id` <> 17
38 */
39 $unique = 'unique:pages,slug,'.$model->id.',id';
40 }
41
26 return [ 42 return [
27 // 43 'name' => [
44 'required',
45 'string',
46 'min:3',
47 'max:255',
48 ],
49 'slug' => [
50 'required',
51 'max:255',
52 $unique,
53 'regex:~^[-_a-z0-9]+$~i',
54 ],
55 'anons' => [
56 'required',
57 'min:500',
58 ],
59 'text' => [
60 'required',
61 'min:500',
62 ],
63 'image' => [
64 'mimes:jpeg,jpg,png',
65 'max:15000'
66 ],
67 ];
68 }
69
70 public function messages() {
71 return [
72 'required' => 'Поле :attribute обязательно для ввода',
73 'unique' => 'Поле :attribute должно быть уникальным',
74 'mimes' => 'Допускаются файлы только с расширением jpeg,jpg,png',
75 'min' => [
76 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
77 'integer' => 'Поле «:attribute» должно быть :min или больше',
78 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
79 ],
80
81 'max' => [
82 'string' => 'Поле «:attribute» должно быть не больше :max символов',
83 'integer' => 'Поле «:attribute» должно быть :max или меньше',
84 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
85 ],
86
28 ]; 87 ];
29 } 88 }
30 } 89 }
31 90
app/Http/Requests/SEORequest.php
File was created 1 <?php
2
3 namespace App\Http\Requests;
4
5 use Illuminate\Foundation\Http\FormRequest;
6
7 class SEORequest 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 false;
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 //
28 ];
29 }
30 }
31
app/Models/pages.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 pages extends Model 8 class pages extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11
12 protected $fillable = [
13 'name',
14 'slug',
15 'text',
16 'anons',
17 'author',
18 'image',
19 ];
11 } 20 }
12 21
resources/views/admin/editbloks/index.blade.php
File was created 1 @extends('layout.admin', ['title' => 'Админка - Редактор шапки-футера сайта'])
2
3 @section('script')
4
5 @endsection
6
7 @section('search')
8 <!--<div class="absolute inset-y-0 flex items-center pl-2">
9 <svg
10 class="w-4 h-4"
11 aria-hidden="true"
12 fill="currentColor"
13 viewBox="0 0 20 20"
14 >
15 <path
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"
18 clip-rule="evenodd"
19 ></path>
20 </svg>
21 </div>
22 <form action="" method="POST">
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"
25 style="width: 400px"
26 type="text"
27 placeholder="Искать..."
28 aria-label="Search"
29 /></div>
30 <div style="float: left">
31 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
32 </div>
33 </form>-->
34 @endsection
35
36 @section('content')
37
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">
39 Добавить опцию
40 </a>
41 <br>
42 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
43
44 <div class="w-full overflow-x-auto">
45 <table class="w-full whitespace-no-wrap">
46 <thead>
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"
49 >
50 <th class="px-4 py-3">№</th>
51 <th class="px-4 py-3">Название</th>
52 <th class="px-4 py-3">Ссылка</th>
53 <th class="px-4 py-3">Категория</th>
54 <th class="px-4 py-3">Шапка</th>
55 <th class="px-4 py-3">Дата создания</th>
56 <th class="px-4 py-3">Редактировать</th>
57 </tr>
58 </thead>
59 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
60 @foreach($header_footer as $page)
61 <tr class="text-gray-700 dark:text-gray-400">
62 <td class="px-4 py-3">
63 {{$page->id}}
64 </td>
65 <td class="px-4 py-3">
66 {{$page->name}}
67 </td>
68 <td class="px-4 py-3">
69 {{$page->link}}
70 </td>
71 <td class="px-4 py-3">
72 {{$page->category}} ({{$page->code_id}})
73 </td>
74 <td class="px-4 py-3">
75 {{$page->created_at}}
76 </td>
77 <td class="px-4 py-3 text-sm_">
78 <form action="{{ route('admin.delete-seo', ['page' => $page->id]) }}" method="POST">
79 <a href="{{ route('admin.edit-seo', ['page' => $page->id]) }}">Изменить</a> |
80 @csrf
81 @method('DELETE')
82 <input class="btn btn-danger" type="submit" value="Удалить"/>
83 </form>
84 </td>
85 </tr>
86 @endforeach
87 </tbody>
88 </table>
89 </div>
90
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">
92 <?=$header_footer->appends($_GET)->links('admin.pagginate'); ?>
93 </div>
94 </div>
95 @endsection
96
resources/views/admin/pages/add.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Добавление страницы']) 1 @extends('layout.admin', ['title' => 'Админка - Добавление страницы'])
2 2
3 @section('content') 3 @section('content')
4 <form method="POST" action="{{ route('admin.add-page-store') }}"> 4 <form method="POST" action="{{ route('admin.add-page-store') }}" enctype="multipart/form-data">
5 @include('admin.pages.form') 5 @include('admin.pages.form')
6 </form> 6 </form>
7 @endsection 7 @endsection
8 8
resources/views/admin/pages/edit.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Редактирование страницы']) 1 @extends('layout.admin', ['title' => 'Админка - Редактирование страницы'])
2 2
3 @section('content') 3 @section('content')
4 <form method="POST" action="{{ route('admin.update-page', ['page' => $page->id]) }}"> 4 <form method="POST" action="{{ route('admin.update-page', ['page' => $page->id]) }}" enctype="multipart/form-data">
5 @include('admin.pages.form') 5 @include('admin.pages.form')
6 </form> 6 </form>
7 @endsection 7 @endsection
8 8
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>
16 function translit(word){
17 var answer = '';
18 var converter = {
19 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',
20 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i',
21 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n',
22 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't',
23 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch',
24 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '',
25 'э': 'e', 'ю': 'yu', 'я': 'ya',
26
27 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D',
28 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I',
29 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N',
30 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T',
31 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch',
32 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '',
33 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-'
34 };
35
36 for (var i = 0; i < word.length; ++i ) {
37 if (converter[word[i]] == undefined){
38 answer += word[i];
39 } else {
40 answer += converter[word[i]];
41 }
42 }
43
44 return answer;
45 }
46
47 window.addEventListener("DOMContentLoaded", (event) => {
48 let title = document.querySelector('#name');
49 let text = document.querySelector('#slug');
50
51 title.addEventListener('input', function() {
52 text.value = translit(this.value);
53 });
54 });
55
56 </script>
7 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 57 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
8 58
9 <label class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 59 <label class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
10 <label class="block text-sm"> 60 <label class="block text-sm">
11 <span class="text-gray-700 dark:text-gray-400">Название страницы</span> 61 <span class="text-gray-700 dark:text-gray-400">Название страницы</span>
12 <input name="name" id="name" 62 <input name="name" id="name"
13 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 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"
14 placeholder="Имя категории" value="{{ old('name') ?? $page->name ?? '' }}" 64 placeholder="Имя категории" value="{{ old('name') ?? $page->name ?? '' }}"
15 /> 65 />
16 @error('name') 66 @error('name')
17 <span class="text-xs text-red-600 dark:text-red-400"> 67 <span class="text-xs text-red-600 dark:text-red-400">
18 {{ $message }} 68 {{ $message }}
19 </span> 69 </span>
20 @enderror 70 @enderror
21 </label><br> 71 </label><br>
22 72
23 <label class="block text-sm"> 73 <label class="block text-sm">
24 <span class="text-gray-700 dark:text-gray-400">Английский псевдоним страницы</span> 74 <span class="text-gray-700 dark:text-gray-400">Английский псевдоним страницы</span>
25 <input name="slug" id="slug" 75 <input name="slug" id="slug"
26 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 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"
27 placeholder="Имя категории" value="{{ old('slug') ?? $page->slug ?? '' }}" 77 placeholder="Имя категории" value="{{ old('slug') ?? $page->slug ?? '' }}"
28 /> 78 />
29 @error('slug') 79 @error('slug')
30 <span class="text-xs text-red-600 dark:text-red-400"> 80 <span class="text-xs text-red-600 dark:text-red-400">
31 {{ $message }} 81 {{ $message }}
32 </span> 82 </span>
33 @enderror 83 @enderror
34 </label><br> 84 </label><br>
35 85
36 <label class="block text-sm"> 86 <label class="block text-sm">
37 <span class="text-gray-700 dark:text-gray-400">Анонс</span> 87 <span class="text-gray-700 dark:text-gray-400">Анонс</span>
38 <textarea class="form-control ckeditor" name="anons" placeholder="Анонс (html)" required 88 <textarea class="form-control ckeditor" name="anons" placeholder="Анонс (html)" required
39 rows="10">{{ old('anons') ?? $page->anons ?? '' }}</textarea> 89 rows="10">{{ old('anons') ?? $page->anons ?? '' }}</textarea>
40 @error('anons') 90 @error('anons')
41 <span class="text-xs text-red-600 dark:text-red-400"> 91 <span class="text-xs text-red-600 dark:text-red-400">
42 {{ $message }} 92 {{ $message }}
43 </span> 93 </span>
44 @enderror 94 @enderror
45 </label><br> 95 </label><br>
46 96
47 <label class="block text-sm"> 97 <label class="block text-sm">
48 <span class="text-gray-700 dark:text-gray-400">Текст</span> 98 <span class="text-gray-700 dark:text-gray-400">Текст</span>
49 <textarea class="form-control ckeditor" name="text" placeholder="Текст (html)" required 99 <textarea class="form-control ckeditor" name="text" placeholder="Текст (html)" required
50 rows="10">{{ old('text') ?? $page->text ?? '' }}</textarea> 100 rows="10">{{ old('text') ?? $page->text ?? '' }}</textarea>
51 @error('text') 101 @error('text')
52 <span class="text-xs text-red-600 dark:text-red-400"> 102 <span class="text-xs text-red-600 dark:text-red-400">
53 {{ $message }} 103 {{ $message }}
54 </span> 104 </span>
55 @enderror 105 @enderror
56 </label><br> 106 </label><br>
57 107
58 <label class="block text-sm"> 108 <label class="block text-sm">
59 <span class="text-gray-700 dark:text-gray-400">Автор</span> 109 <span class="text-gray-700 dark:text-gray-400">Автор</span>
60 <input name="author" id="author" 110 <input name="author" id="author"
61 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" 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"
62 placeholder="Имя категории" value="{{ old('author') ?? $page->author ?? '' }}" 112 placeholder="Имя категории" value="{{ old('author') ?? $page->author ?? '' }}"
63 /> 113 />
64 @error('author') 114 @error('author')
65 <span class="text-xs text-red-600 dark:text-red-400"> 115 <span class="text-xs text-red-600 dark:text-red-400">
66 {{ $message }} 116 {{ $message }}
67 </span> 117 </span>
68 @enderror 118 @enderror
69 </label><br> 119 </label><br>
70 120
71 <label class="block text-sm"> 121 <label class="block text-sm">
72 <input type="file" class="form-control-file" name="image" accept="image/png, image/jpeg"> 122 <span class="text-gray-700 dark:text-gray-400">Картинка</span>
73 </label> 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">
124 </label><br>
74 125
75 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 126 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
76 <div> 127 <div>
77 <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"> 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">
78 Сохранить 129 Сохранить
79 </button> 130 </button>
80 </div> 131 </div>
81 </div> 132 </div>
82 </div> 133 </div>
83 134
resources/views/admin/pages/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-page') }}" style="width: 170px" 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-page') }}" style="width: 170px" 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 </tr> 55 </tr>
56 </thead> 56 </thead>
57 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 57 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
58 @foreach($pages as $page) 58 @foreach($pages as $page)
59 <tr class="text-gray-700 dark:text-gray-400"> 59 <tr class="text-gray-700 dark:text-gray-400">
60 <td class="px-4 py-3"> 60 <td class="px-4 py-3">
61 {{$page->id}} 61 {{$page->id}}
62 </td> 62 </td>
63 <td class="px-4 py-3"> 63 <td class="px-4 py-3">
64 {{$page->name}} 64 {{$page->name}}
65 </td> 65 </td>
66 <td class="px-4 py-3"> 66 <td class="px-4 py-3">
67 {{ action([\App\Http\Controllers\PagesController::class, 'pages'], ['slug' => $page->slug]) }} 67 <a target="blank" href="{{ route('page', ['pages' => $page]) }}">{{ route('page', ['pages' => $page]) }}</a>
68 </td> 68 </td>
69 <td class="px-4 py-3"> 69 <td class="px-4 py-3">
70 {{$page->created_at}} 70 {{$page->created_at}}
71 </td> 71 </td>
72 <td class="px-4 py-3 text-sm_"> 72 <td class="px-4 py-3 text-sm_">
73 <form action="{{ route('admin.delete-page', ['page' => $page->id]) }}" method="POST"> 73 <form action="{{ route('admin.delete-page', ['page' => $page->id]) }}" method="POST">
74 <a href="{{ route('admin.edit-page', ['page' => $page->id]) }}">Изменить</a> | 74 <a href="{{ route('admin.edit-page', ['page' => $page->id]) }}">Изменить</a> |
75 @csrf 75 @csrf
76 @method('DELETE') 76 @method('DELETE')
77 <input class="btn btn-danger" type="submit" value="Удалить"/> 77 <input class="btn btn-danger" type="submit" value="Удалить"/>
78 </form> 78 </form>
79 </td> 79 </td>
80 </tr> 80 </tr>
81 @endforeach 81 @endforeach
82 </tbody> 82 </tbody>
83 </table> 83 </table>
84 </div> 84 </div>
85 85
86 <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"> 86 <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">
87 <?=$pages->appends($_GET)->links('admin.pagginate'); ?> 87 <?=$pages->appends($_GET)->links('admin.pagginate'); ?>
88 </div> 88 </div>
89 </div> 89 </div>
90 @endsection 90 @endsection
91 91
resources/views/admin/reclames/index.blade.php
File was created 1 @extends('layout.admin', ['title' => 'Админка - Реклама сайта'])
2
3 @section('script')
4
5 @endsection
6
7 @section('search')
8 <!--<div class="absolute inset-y-0 flex items-center pl-2">
9 <svg
10 class="w-4 h-4"
11 aria-hidden="true"
12 fill="currentColor"
13 viewBox="0 0 20 20"
14 >
15 <path
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"
18 clip-rule="evenodd"
19 ></path>
20 </svg>
21 </div>
22 <form action="" method="POST">
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"
25 style="width: 400px"
26 type="text"
27 placeholder="Искать..."
28 aria-label="Search"
29 /></div>
30 <div style="float: left">
31 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
32 </div>
33 </form>-->
34 @endsection
35
36 @section('content')
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">
39 Добавить рекламу
40 </a>
41 <br>
42 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
43
44 <div class="w-full overflow-x-auto">
45 <table class="w-full whitespace-no-wrap">
46 <thead>
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"
49 >
50 <th class="px-4 py-3">№</th>
51 <th class="px-4 py-3">Заголовок</th>
52 <th class="px-4 py-3">Ссылка</th>
53 <th class="px-4 py-3">Позиция</th>
54 <th class="px-4 py-3">Скрыть</th>
55 <th class="px-4 py-3">Клики</th>
56 <th class="px-4 py-3">Редактировать</th>
57 </tr>
58 </thead>
59 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
60 @foreach($reclames as $reclame)
61 <tr class="text-gray-700 dark:text-gray-400">
62 <td class="px-4 py-3">
63 {{$reclame->id}}
64 </td>
65 <td class="px-4 py-3">
66 {{$reclame->title}}
67 </td>
68 <td class="px-4 py-3">
69 {{$reclame->link}}
70 </td>
71 <td class="px-4 py-3">
72 {{$reclame->position}}
73 </td>
74 <td class="px-4 py-3">
75 {{$reclame->is_hidden}}
76 </td>
77 <td class="px-4 py-3">
78 {{$reclame->col_vo_click}}
79 </td>
80 <td class="px-4 py-3 text-sm_">
81 <form action="{{ route('admin.delete-seo', ['page' => $reclame->id]) }}" method="POST">
82 <a href="{{ route('admin.edit-seo', ['page' => $reclame->id]) }}">Изменить</a> |
83 @csrf
84 @method('DELETE')
85 <input class="btn btn-danger" type="submit" value="Удалить"/>
86 </form>
87 </td>
88 </tr>
89 @endforeach
90 </tbody>
91 </table>
92 </div>
93
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">
95 <?=$reclames->appends($_GET)->links('admin.pagginate'); ?>
96 </div>
97 </div>
98 @endsection
99
resources/views/admin/seo/add.blade.php
resources/views/admin/seo/edit.blade.php
resources/views/admin/seo/form.blade.php
resources/views/admin/seo/index.blade.php
File was created 1 @extends('layout.admin', ['title' => 'Админка - Страницы SEO сайта'])
2
3 @section('script')
4
5 @endsection
6
7 @section('search')
8 <!--<div class="absolute inset-y-0 flex items-center pl-2">
9 <svg
10 class="w-4 h-4"
11 aria-hidden="true"
12 fill="currentColor"
13 viewBox="0 0 20 20"
14 >
15 <path
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"
18 clip-rule="evenodd"
19 ></path>
20 </svg>
21 </div>
22 <form action="" method="POST">
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"
25 style="width: 400px"
26 type="text"
27 placeholder="Искать..."
28 aria-label="Search"
29 /></div>
30 <div style="float: left">
31 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
32 </div>
33 </form>-->
34 @endsection
35
36 @section('content')
37
38 <a href="{{ route('admin.add-seo') }}" style="width: 200px" 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 Добавить seo странице
40 </a>
41 <br>
42 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
43
44 <div class="w-full overflow-x-auto">
45 <table class="w-full whitespace-no-wrap">
46 <thead>
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"
49 >
50 <th class="px-4 py-3">№</th>
51 <th class="px-4 py-3">URL страницы</th>
52 <th class="px-4 py-3">title страницы</th>
53 <th class="px-4 py-3">Дата создания</th>
54 <th class="px-4 py-3">Редактировать</th>
55 </tr>
56 </thead>
57 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
58 @foreach($pages as $page)
59 <tr class="text-gray-700 dark:text-gray-400">
60 <td class="px-4 py-3">
61 {{$page->id}}
62 </td>
63 <td class="px-4 py-3">
64 {{$page->url}}
65 </td>
66 <td class="px-4 py-3">
67 {{$page->title}}
68 </td>
69 <td class="px-4 py-3">
70 {{$page->created_at}}
71 </td>
72 <td class="px-4 py-3 text-sm_">
73 <form action="{{ route('admin.delete-seo', ['page' => $page->id]) }}" method="POST">
74 <a href="{{ route('admin.edit-seo', ['page' => $page->id]) }}">Изменить</a> |
75 @csrf
76 @method('DELETE')
77 <input class="btn btn-danger" type="submit" value="Удалить"/>
78 </form>
79 </td>
80 </tr>
81 @endforeach
82 </tbody>
83 </table>
84 </div>
85
86 <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">
87 <?=$pages->appends($_GET)->links('admin.pagginate'); ?>
88 </div>
89 </div>
90 @endsection
91
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\Models\User; 13 use App\Models\User;
13 use App\Http\Controllers\MainController; 14 use App\Http\Controllers\MainController;
14 use App\Http\Controllers\HomeController; 15 use App\Http\Controllers\HomeController;
15 use Illuminate\Support\Facades\Route; 16 use Illuminate\Support\Facades\Route;
16 use App\Http\Controllers\Admin\CompanyController; 17 use App\Http\Controllers\Admin\CompanyController;
17 use App\Http\Controllers\Admin\Ad_EmployersController; 18 use App\Http\Controllers\Admin\Ad_EmployersController;
18 use App\Http\Controllers\Admin\MsgAnswersController; 19 use App\Http\Controllers\Admin\MsgAnswersController;
19 use App\Http\Controllers\Admin\GroupsController; 20 use App\Http\Controllers\Admin\GroupsController;
21 use App\Http\Controllers\PagesController;
20 22
21 23
22 /* 24 /*
23 |-------------------------------------------------------------------------- 25 |--------------------------------------------------------------------------
24 | Web Routes 26 | Web Routes
25 |-------------------------------------------------------------------------- 27 |--------------------------------------------------------------------------
26 | 28 |
27 | 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
28 | routes are loaded by the RouteServiceProvider within a group which 30 | routes are loaded by the RouteServiceProvider within a group which
29 | contains the "web" middleware group. Now create something great! 31 | contains the "web" middleware group. Now create something great!
30 | 32 |
31 */ 33 */
32 /* 34 /*
33 Route::get('/', function () { 35 Route::get('/', function () {
34 return view('welcome'); 36 return view('welcome');
35 })->name('index'); 37 })->name('index');
36 */ 38 */
37 Route::get('/', [MainController::class, 'index'])->name('index'); 39 Route::get('/', [MainController::class, 'index'])->name('index');
38 40
39 //Роуты авторизации, регистрации, восстановления, аутентификации 41 //Роуты авторизации, регистрации, восстановления, аутентификации
40 Auth::routes(['verify' => true]); 42 Auth::routes(['verify' => true]);
41 //Личный кабинет пользователя 43 //Личный кабинет пользователя
42 Route::get('/home', [HomeController::class, 'index'])->name('home'); 44 Route::get('/home', [HomeController::class, 'index'])->name('home');
43 45
44 /* 46 /*
45 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { 47 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) {
46 $user = User::where('email',$request->input('email'))->first(); 48 $user = User::where('email',$request->input('email'))->first();
47 49
48 $user->sendEmailVerificationNotification(); 50 $user->sendEmailVerificationNotification();
49 51
50 return 'your response'; 52 return 'your response';
51 })->middleware('throttle:6,1')->name('verification.resend'); 53 })->middleware('throttle:6,1')->name('verification.resend');
52 */ 54 */
53 55
54 // Авторизация, регистрация в админку 56 // Авторизация, регистрация в админку
55 Route::group([ 57 Route::group([
56 'as' => 'admin.', // имя маршрута, например auth.index 58 'as' => 'admin.', // имя маршрута, например auth.index
57 'prefix' => 'admin', // префикс маршрута, например auth/index 59 'prefix' => 'admin', // префикс маршрута, например auth/index
58 'middleware' => ['guest'], 60 'middleware' => ['guest'],
59 ], function () { 61 ], function () {
60 // Форма регистрации 62 // Форма регистрации
61 Route::get('register', [AdminController::class, 'register'])->name('register'); 63 Route::get('register', [AdminController::class, 'register'])->name('register');
62 64
63 // Создание пользователя 65 // Создание пользователя
64 Route::post('register', [AdminController::class, 'create'])->name('create'); 66 Route::post('register', [AdminController::class, 'create'])->name('create');
65 //Форма входа 67 //Форма входа
66 Route::get('login', [AdminController::class, 'login'])->name('login'); 68 Route::get('login', [AdminController::class, 'login'])->name('login');
67 69
68 // аутентификация 70 // аутентификация
69 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 71 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
70 72
71 }); 73 });
72 74
73 // Личный кабинет админки 75 // Личный кабинет админки
74 Route::group([ 76 Route::group([
75 'as' => 'admin.', // имя маршрута, например auth.index 77 'as' => 'admin.', // имя маршрута, например auth.index
76 'prefix' => 'admin', // префикс маршрута, например auth/index 78 'prefix' => 'admin', // префикс маршрута, например auth/index
77 'middleware' => ['auth'], ['admin'], 79 'middleware' => ['auth'], ['admin'],
78 ], function() { 80 ], function() {
79 81
80 // выход 82 // выход
81 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 83 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
82 84
83 // кабинет главная страница 85 // кабинет главная страница
84 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 86 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
85 87
86 // кабинет профиль админа - форма 88 // кабинет профиль админа - форма
87 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 89 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
88 // кабинет профиль админа - сохранение формы 90 // кабинет профиль админа - сохранение формы
89 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 91 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
90 92
91 // кабинет профиль - форма пароли 93 // кабинет профиль - форма пароли
92 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 94 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
93 // кабинет профиль - сохранение формы пароля 95 // кабинет профиль - сохранение формы пароля
94 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 96 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
95 97
96 98
97 // кабинет профиль пользователя - форма 99 // кабинет профиль пользователя - форма
98 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');
99 // кабинет профиль пользователя - сохранение формы 101 // кабинет профиль пользователя - сохранение формы
100 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');
101 103
102 // кабинет профиль работодатель - форма 104 // кабинет профиль работодатель - форма
103 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');
104 // кабинет профиль работодатель - сохранение формы 106 // кабинет профиль работодатель - сохранение формы
105 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');
106 108
107 // кабинет профиль работник - форма 109 // кабинет профиль работник - форма
108 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');
109 111
110 // кабинет настройки сайта - форма 112 // кабинет настройки сайта - форма
111 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 113 Route::get('config', [AdminController::class, 'config_form'])->name('config');
112 // кабинет настройки сайта сохранение формы 114 // кабинет настройки сайта сохранение формы
113 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 115 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
114 116
115 // кабинет - пользователи 117 // кабинет - пользователи
116 Route::get('users', [UsersController::class, 'index'])->name('users'); 118 Route::get('users', [UsersController::class, 'index'])->name('users');
117 119
118 // кабинет - пользователи 120 // кабинет - пользователи
119 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 121 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
120 122
121 // кабинет - работодатели 123 // кабинет - работодатели
122 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 124 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
123 125
124 // кабинет - соискатели 126 // кабинет - соискатели
125 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 127 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
126 128
127 // кабинет - вакансии 129 // кабинет - вакансии
128 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 130 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
129 131
130 // кабинет - категории 132 // кабинет - категории
131 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 133 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
132 /* 134 /*
133 * CRUD-операции над Справочником Категории 135 * CRUD-операции над Справочником Категории
134 */ 136 */
135 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 137 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
136 138
137 139
138 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); 140 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
139 /* 141 /*
140 * кабинет - CRUD-операции по справочнику должности 142 * кабинет - CRUD-операции по справочнику должности
141 * 143 *
142 */ 144 */
143 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); 145 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
144 146
145 // кабинет - сообщения 147 // кабинет - сообщения
146 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 148 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
147 149
148 /* 150 /*
149 * Расписанный подход в описании каждой директорий групп пользователей. 151 * Расписанный подход в описании каждой директорий групп пользователей.
150 */ 152 */
151 // кабинет - группы пользователей 153 // кабинет - группы пользователей
152 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 154 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
153 // кабинет - добавление форма группы пользователей 155 // кабинет - добавление форма группы пользователей
154 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 156 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
155 // кабинет - сохранение формы группы пользователей 157 // кабинет - сохранение формы группы пользователей
156 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 158 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
157 // кабинет - редактирование форма группы пользователей 159 // кабинет - редактирование форма группы пользователей
158 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 160 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
159 // кабинет - сохранение редактированной формы группы пользователей 161 // кабинет - сохранение редактированной формы группы пользователей
160 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 162 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
161 // кабинет - удаление группы пользователей 163 // кабинет - удаление группы пользователей
162 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); 164 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
163 165
164 // кабинет - список админов 166 // кабинет - список админов
165 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 167 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
166 168
167 /////редактор////// кабинет - редактор сайта//////////////////////// 169 /////редактор////// кабинет - редактор сайта////////////////////////
168 Route::get('editor-site', function() { 170 Route::get('editor-site', function() {
169 return view('admin.editor.index'); 171 return view('admin.editor.index');
170 })->name('editor-site'); 172 })->name('editor-site');
171 173
172 // кабинет - редактор шапки-футера сайта 174 // кабинет - редактор шапки-футера сайта
173 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 175 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
174 176
175 // кабинет - редактор должности на главной 177 // кабинет - редактор должности на главной
176 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');
177 179
178 // кабинет - редактор работодатели на главной 180 // кабинет - редактор работодатели на главной
179 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 181 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
180 182
181 // кабинет - редактор seo-сайта 183 // кабинет - редактор seo-сайта
182 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 184 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::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store');
187 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo');
188 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo');
189 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo');
183 190
184 191
185 // кабинет - редактор страниц 192 // кабинет - редактор страниц
186 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 193 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
187 // кабинет - добавление страницы 194 // кабинет - добавление страницы
188 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); 195 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
189 // кабинет - сохранение формы страницы 196 // кабинет - сохранение формы страницы
190 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); 197 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
191 // кабинет - редактирование форма страницы 198 // кабинет - редактирование форма страницы
192 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); 199 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
193 // кабинет - сохранение редактированной формы страницы 200 // кабинет - сохранение редактированной формы страницы
194 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); 201 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
195 // кабинет - удаление страницы 202 // кабинет - удаление страницы
196 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); 203 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
197 204
198 205
199 // кабинет - реклама сайта 206 // кабинет - реклама сайта
200 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 207 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
201 //////////////////////////////////////////////////////////////////////// 208 ////////////////////////////////////////////////////////////////////////
202 209
203 // кабинет - отзывы о работодателе для модерации 210 // кабинет - отзывы о работодателе для модерации
204 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 211 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
205 212
206 // Общая страница статистики 213 // Общая страница статистики
207 Route::get('statics', function () { 214 Route::get('statics', function () {
208 return view('admin.static.index'); 215 return view('admin.static.index');
209 })->name('statics'); 216 })->name('statics');
210 217
211 // кабинет - статистика работников 218 // кабинет - статистика работников
212 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 219 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
213 220
214 // кабинет - статистика вакансий работодателя 221 // кабинет - статистика вакансий работодателя
215 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 222 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
216 223
217 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 224 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
218 /* 225 /*
219 * CRUD-операции над справочником дипломы и документы 226 * CRUD-операции над справочником дипломы и документы
220 */ 227 */
221 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 228 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
222 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); 229 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]);
223 230
224 // кабинет - роли пользователя 231 // кабинет - роли пользователя
225 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 232 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
226 233
227 }); 234 });
235
236 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
237
238 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
228 239