Route::fallback(function ()
{
return redirect()->to('/');
});
/app/Exceptions/Handler.php
/**
* Render an exception into a response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if ($e instanceof NotFoundHttpException) {
return redirect()->to('/');
}
return parent::render($request, $e);
}
public function handle($request, Closure $next)
{
if(! in_array($request->route()->getName(), ['home', 'pages'])) {
return redirect()->route('home');
}
return $next($request);
}
<link rel="apple-touch-icon" />
или <link rel="icon" />
.img src
. $store.state.loading === true
.this.loadData();
this.$store.dispatch('loadData');
class Config {
private static $configData;
public static function get($parameter = null, $default = null)
{
if (is_null(self::$configData)) {
self::$configData = include '../config.php';
}
if ($parameter) {
return self::$configData[$parameter] ?? $default;
}
return self::$configData;
}
}
// в клиентском методе
public function someMethod() {
$config = Config::get();
}
<?php
// в config.php
return [
'param' => 'value',
];
?>
$str = '<div class="stove-preview__main-img" style="background-image: url(\'/upload/resize_cache/iblock/114/245_600_2.jpg\')>';
preg_match('/background-image:\s*url\([\'"]?(?<image_url>[^\'")]+)[\'"]?\s*\)/', $str, $matches);
$imageUrl = $matches['image_url'] ?? null;
// /upload/resize_cache/iblock/114/245_600_2.jpg