saved jobs

This commit is contained in:
Doar Mihai
2026-05-01 02:58:06 +03:00
parent 75388cfb95
commit 17097c3bb1
7 changed files with 133 additions and 14 deletions
+14 -7
View File
@@ -2,23 +2,30 @@
namespace App\Providers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
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));
});
}
}