diff --git a/app/Services/PageScrapper.php b/app/Services/PageScrapper.php new file mode 100644 index 0000000..bd86bad --- /dev/null +++ b/app/Services/PageScrapper.php @@ -0,0 +1,36 @@ +') + { + $this->url = $url; + $this->contentMarker = $contentMarker; + } + + public function getHTML() + { + $page = file_get_contents($this->url); + $strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/isU"; + $arr = []; + $rez = preg_match_all($strForPregMatch, $page, $arr); + return $content = $arr[1][0].''; + + } + + public function normalizeURLFile($content) + { + $rez = preg_match_all('/href="(.*)"/isU',$content,$arr); + foreach ($arr[1] as $el) { + if (strpos($el, 'http') !== 0) { + $content = str_replace($el,'https://mkgtu.ru'.$el,$content); + } + } + return $content; + } +} diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index bd61e94..23893c0 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -44,11 +44,6 @@ - {{--
- @if (Route::has('register')) - Нет аккаунта? - Зарегистрируйтесь - @endif -
--}} + diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 2e3c737..6547279 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -26,7 +26,7 @@
- +
diff --git a/resources/views/layouts/applicant-layout.blade.php b/resources/views/layouts/applicant-layout.blade.php index dd0ab46..1022be4 100644 --- a/resources/views/layouts/applicant-layout.blade.php +++ b/resources/views/layouts/applicant-layout.blade.php @@ -135,23 +135,7 @@ Контакты - {{-- Добавляет на хедер страницы кнопку "вход", имя которой меняется, если вы уже авторизованы -
  • - @if (Route::has('login')) - - @auth - {{ Auth::user()->name }} - @else - Вход - - - - @endauth - - @endif - -
  • - --}} +
    diff --git a/resources/views/pages/abitur.blade.php b/resources/views/menu/abitur.blade.php similarity index 98% rename from resources/views/pages/abitur.blade.php rename to resources/views/menu/abitur.blade.php index 64e1f27..f319136 100644 --- a/resources/views/pages/abitur.blade.php +++ b/resources/views/menu/abitur.blade.php @@ -16,7 +16,7 @@
    + @endsection diff --git a/resources/views/menu/abitur/web-consultations.blade.php b/resources/views/menu/abitur/web-consultations.blade.php new file mode 100644 index 0000000..efaa0a8 --- /dev/null +++ b/resources/views/menu/abitur/web-consultations.blade.php @@ -0,0 +1,18 @@ +@extends('layouts.applicant-layout') +@section('content') +
    Веб-консультации для абитуриентов и их родителей
    +
    + +
    +@php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '
    '); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + echo $content; + + @endphp + +
    +
    +@endsection diff --git a/resources/views/menu/course.blade.php b/resources/views/menu/course.blade.php new file mode 100644 index 0000000..05fdcd0 --- /dev/null +++ b/resources/views/menu/course.blade.php @@ -0,0 +1,49 @@ +@extends('layouts.applicant-layout') +@section('content') + + + +
    Подача документов онлайн
    +
    + +
    + @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '
    '); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + echo $content; + + @endphp + +
    +
    + +@endsection diff --git a/resources/views/pages/course.blade.php b/resources/views/pages/course.blade.php deleted file mode 100644 index 9654559..0000000 --- a/resources/views/pages/course.blade.php +++ /dev/null @@ -1,104 +0,0 @@ -@extends('layouts.applicant-layout') -@section('content') - - - - - - - - - -
    - -@endsection diff --git a/routes/web.php b/routes/web.php index 7ed14af..7592924 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,13 +27,17 @@ Route::resources([ ]); Route::get('/course', function () { - return view('pages.course'); + return view('menu.course'); })->name('course'); Route::get('/abitur', function () { - return view('pages.abitur'); + return view('menu.abitur'); })->name('applicant'); +Route::get('/web-consultations', function () { + return view('menu.abitur.web-consultations'); +})->name('web-consultations'); + Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile'); Route::get('/dashboard', function () {