@props(['identity', 'type', 'btnClass' => 'absolute top-6 right-6 p-2 bg-white rounded-full hover:text-red-500 transition-colors z-20']) @php $uniqueId = 'bookmark_' . $identity . '_' . uniqid(); @endphp @if(Auth::guard('web')->check()) @php $bookmark_exists = \App\Models\Bookmark::where('user_id', Auth::guard('web')->user()->id) ->where('identity', $identity) ->where('is_project_job', $type) ->first(); $user_type = Auth::guard('web')->user()->user_type; $add_route = $user_type == 1 ? route('client.bookmark') : route('freelancer.bookmark'); $remove_route = $user_type == 1 ? route('client.bookmark.remove') : route('freelancer.bookmark.remove'); @endphp @if($bookmark_exists) {{-- Remove bookmark button --}} @else {{-- Add bookmark button --}} @endif @else {{-- Guest user - prompt login --}} @endif {{-- Initialize bookmark handler script --}} @once @push('page_scripts') @endpush @endonce