Files

32 lines
752 B
PHP
Raw Permalink Normal View History

2026-04-02 23:00:12 +03:00
<?php
namespace App\Providers;
2026-05-01 02:58:06 +03:00
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
2026-04-02 23:00:12 +03:00
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
}
public function boot(): void
{
2026-05-01 02:58:06 +03:00
View::composer('components.job-card', function ($view) {
static $bookmarkedIds = null;
if ($bookmarkedIds === null) {
$bookmarkedIds = Auth::check()
? Auth::user()->savedJobs()->pluck('job_id')->flip()
: collect();
}
$job = $view->getData()['job'];
$view->with('bookmarked', $bookmarkedIds->has($job->id));
});
2026-04-02 23:00:12 +03:00
}
}