Browse Source

adding #6

develop
HerrHase 3 years ago
parent
commit
4ce01e8b99
2 changed files with 14 additions and 2 deletions
  1. +13
    -0
      app/Functions/Blade.php
  2. +1
    -2
      resources/views/layout.blade.php

+ 13
- 0
app/Functions/Blade.php View File

@ -40,3 +40,16 @@ function asset($path, $prefix = '/public')
return $path; return $path;
} }
/**
* getting name of view as slug
*
* @param array $page
* @return string
*
*/
function viewName(array $page)
{
$slugify = new \Cocur\Slugify\Slugify();
return $slugify->slugify($page['data']['view']);
}

+ 1
- 2
resources/views/layout.blade.php View File

@ -1,6 +1,5 @@
@inject('pageRepository', 'App\Repositories\PageRepository') @inject('pageRepository', 'App\Repositories\PageRepository')
@inject('markdownHelper', 'App\Helpers\MarkdownHelper') @inject('markdownHelper', 'App\Helpers\MarkdownHelper')
@inject('slugify', 'Cocur\Slugify\Slugify')
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de-DE" class="no-js"> <html lang="de-DE" class="no-js">
@ -17,7 +16,7 @@
@stack('head') @stack('head')
</head> </head>
<body class="{{ $slugify->slugify($page['data']['view']) }}">
<body class="{{ viewName($page) }}">
<header class="site-header"> <header class="site-header">
<h1 class="site-header__title"> <h1 class="site-header__title">


Loading…
Cancel
Save