Refresh
This commit is contained in:
39
app/Providers/BladeServiceProvider.php
Executable file
39
app/Providers/BladeServiceProvider.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user