2020-02-25 14:14:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use Backpack\PageManager\app\Models\Page;
|
2020-02-25 16:03:49 +00:00
|
|
|
use Illuminate\Support\Facades\Config;
|
2020-04-07 14:48:45 +00:00
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
2020-02-25 14:14:19 +00:00
|
|
|
class PageController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function index($slug, $subs = null)
|
|
|
|
|
{
|
2020-04-07 14:48:45 +00:00
|
|
|
$page_slug = Str::endsWith($slug,'_tk') || Str::endsWith($slug,'_ru')? $slug : $slug.'_'.config('app.locale');
|
|
|
|
|
|
|
|
|
|
$page = Page::findBySlug($page_slug);
|
2020-02-25 14:14:19 +00:00
|
|
|
|
|
|
|
|
if (!$page)
|
|
|
|
|
{
|
|
|
|
|
abort(404, 'Please go back to our <a href="'.url('').'">homepage</a>.');
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-25 15:02:10 +00:00
|
|
|
$data['title'] = $page->title;
|
2020-02-25 15:13:34 +00:00
|
|
|
$data['page'] = $page->content;
|
2020-02-25 14:14:19 +00:00
|
|
|
|
2020-03-03 11:26:47 +00:00
|
|
|
return $this->render('Pages.AboutPage', $data);
|
2020-02-25 14:14:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|