richard
/
cyca
Archived
1
0
Fork 0
This repository has been archived on 2024-05-04. You can view files and clone it, but cannot push or open issues or pull requests.
cyca/app/Providers/BladeServiceProvider.php

40 lines
778 B
PHP
Executable File

<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class BladeServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register()
{
}
/**
* Bootstrap services.
*/
public function boot()
{
$this->registerHighlights();
}
/**
* Register user's highlights into view.
*/
protected function registerHighlights()
{
view()->composer('*', function ($view) {
if (!auth()->check()) {
return;
}
$highlights = auth()->user()->highlights()->select(['id', 'expression', 'color', 'position'])->orderBy('position')->get();
view()->share('highlights', $highlights);
});
}
}