<commit_before><?php

namespace Coyote\Http\Controllers\Adm;

use Coyote\Http\Controllers\Controller;
use Lavary\Menu\Menu;
use Illuminate\Contracts\Cache\Repository as Cache;

/**
 * Class BaseController
 * @package Coyote\Http\Controllers\Adm
 */
class BaseController extends Controller
{
    /**
     * @return \Lavary\Menu\Builder
     */
    protected function buildMenu()
    {
        return $this->getMenuFactory()->make('adm', function ($menu) {
            $html = app('html');
            $fa = function ($icon) use ($html) {
                return $html->tag('i', '', ['class' => "fa $icon"]);
            };

            /** @var \Lavary\Menu\Builder $menu */
            $menu->add('Strona główna', ['route' => 'adm.dashboard'])->prepend($fa('fa-desktop fa-fw'));
            $menu->add('Użytkownicy', ['route' => 'adm.user'])->prepend($fa('fa-user fa-fw'));
            $menu->add('Grupy', ['route' => 'adm.groups'])->prepend($fa('fa-users fa-fw'))->data('permission', 'adm-group');
            $menu->add('Bany', ['route' => 'adm.firewall'])->prepend($fa('fa-ban fa-fw'));
            $menu->add('Kto jest online', ['route' => 'adm.sessions'])->prepend($fa('fa-eye fa-fw'));

            $forum = $menu->add('Forum', []);
            $forum->link->attr(['data-toggle' => "collapse", 'aria-expanded' => "false", 'aria-controls' => "menu-forum"]);
            $forum->link->href('#menu-forum');

            $forum->prepend($fa('fa-comments fa-fw'));
            $forum->append($html->tag('i', '', ['class' => 'arrow fa fa-angle-left pull-right']));

            $forum->add('Kategorie', ['route' => 'adm.forum.categories']);
            $forum->add('Uprawnienia', ['route' => 'adm.forum.permissions'])->data('permission', 'adm-group');

            $menu->add('Dziennik zdarzeń', ['route' => 'adm.stream'])->prepend($fa('fa-newspaper-o fa-fw'));
            $menu->add('Raporty', ['route' => 'adm.flag'])->prepend($fa('fa-flag fa-fw'));
            $menu->add('Cenzura', ['route' => 'adm.words'])->prepend($fa('fa-flash fa-fw'));
            $menu->add('Bloki statyczne', ['route' => 'adm.blocks'])->prepend($fa('fa-columns fa-fw'));

            $log = $menu->add('Logi', ['route' => 'adm.log'])->prepend($fa('fa-file-o fa-fw'));
            $log->link->attr(['data-toggle' => "collapse", 'aria-expanded' => "false", 'aria-controls' => "menu-log"]);
            $log->link->href('#menu-log');

            $logViewer = $this->getLogViewer();
            $files = $logViewer->getFiles();

            foreach ($files as $file) {
                $log->add($file, route('adm.log', ['file' => $file]));
            }
        })
        ->filter(function ($item) {
            if ($item->data('permission')) {
                return auth()->user()->can($item->data('permission'));
            }

            return true;
        });
    }

    /**
     * @return Menu
     */
    protected function getMenuFactory()
    {
        return app(Menu::class);
    }

    /**
     * @return \Coyote\Services\LogViewer\LogViewer
     */
    protected function getLogViewer()
    {
        return app('log-viewer');
    }

    protected function flushPermission()
    {
        app(Cache::class)->tags('permissions')->flush();
    }
}<commit_msg>dodanie breadcrumba z url do panelu administracyjnego (strona glowna)<commit_after><?php

namespace Coyote\Http\Controllers\Adm;

use Coyote\Http\Controllers\Controller;
use Lavary\Menu\Menu;
use Illuminate\Contracts\Cache\Repository as Cache;

/**
 * Class BaseController
 * @package Coyote\Http\Controllers\Adm
 */
class BaseController extends Controller
{
    public function __construct()
    {
        parent::__construct();

        $this->breadcrumb->push('Panel administracyjny', route('adm.home'));
    }

    /**
     * @return \Lavary\Menu\Builder
     */
    protected function buildMenu()
    {
        return $this->getMenuFactory()->make('adm', function ($menu) {
            $html = app('html');
            $fa = function ($icon) use ($html) {
                return $html->tag('i', '', ['class' => "fa $icon"]);
            };

            /** @var \Lavary\Menu\Builder $menu */
            $menu->add('Strona główna', ['route' => 'adm.dashboard'])->prepend($fa('fa-desktop fa-fw'));
            $menu->add('Użytkownicy', ['route' => 'adm.user'])->prepend($fa('fa-user fa-fw'));
            $menu->add('Grupy', ['route' => 'adm.groups'])->prepend($fa('fa-users fa-fw'))->data('permission', 'adm-group');
            $menu->add('Bany', ['route' => 'adm.firewall'])->prepend($fa('fa-ban fa-fw'));
            $menu->add('Kto jest online', ['route' => 'adm.sessions'])->prepend($fa('fa-eye fa-fw'));

            $forum = $menu->add('Forum', []);
            $forum->link->attr(['data-toggle' => "collapse", 'aria-expanded' => "false", 'aria-controls' => "menu-forum"]);
            $forum->link->href('#menu-forum');

            $forum->prepend($fa('fa-comments fa-fw'));
            $forum->append($html->tag('i', '', ['class' => 'arrow fa fa-angle-left pull-right']));

            $forum->add('Kategorie', ['route' => 'adm.forum.categories']);
            $forum->add('Uprawnienia', ['route' => 'adm.forum.permissions'])->data('permission', 'adm-group');

            $menu->add('Dziennik zdarzeń', ['route' => 'adm.stream'])->prepend($fa('fa-newspaper-o fa-fw'));
            $menu->add('Raporty', ['route' => 'adm.flag'])->prepend($fa('fa-flag fa-fw'));
            $menu->add('Cenzura', ['route' => 'adm.words'])->prepend($fa('fa-flash fa-fw'));
            $menu->add('Bloki statyczne', ['route' => 'adm.blocks'])->prepend($fa('fa-columns fa-fw'));

            $log = $menu->add('Logi', ['route' => 'adm.log'])->prepend($fa('fa-file-o fa-fw'));
            $log->link->attr(['data-toggle' => "collapse", 'aria-expanded' => "false", 'aria-controls' => "menu-log"]);
            $log->link->href('#menu-log');

            $logViewer = $this->getLogViewer();
            $files = $logViewer->getFiles();

            foreach ($files as $file) {
                $log->add($file, route('adm.log', ['file' => $file]));
            }
        })
        ->filter(function ($item) {
            if ($item->data('permission')) {
                return auth()->user()->can($item->data('permission'));
            }

            return true;
        });
    }

    /**
     * @return Menu
     */
    protected function getMenuFactory()
    {
        return app(Menu::class);
    }

    /**
     * @return \Coyote\Services\LogViewer\LogViewer
     */
    protected function getLogViewer()
    {
        return app('log-viewer');
    }

    /**
     * Clear users cache permission after updating groups etc.
     */
    protected function flushPermission()
    {
        app(Cache::class)->tags('permissions')->flush();
    }
}
{'fraction_non_alphanumeric': 0.2259537487111504, 'fraction_numerical': 0.0, 'mean_word_length': 2.4910025706940875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '966306', 'n_tokens_mistral': 2213, 'n_tokens_neox': 2141, 'n_words': 341}