Skip to content

Instantly share code, notes, and snippets.

View Benyaminrmb's full-sized avatar
:shipit:
Code is poetry, and I'm a master wordsmith

Benyamin Bolhassani Benyaminrmb

:shipit:
Code is poetry, and I'm a master wordsmith
View GitHub Profile
@Benyaminrmb
Benyaminrmb / ExploreController.php
Created October 14, 2023 20:22
this is home method
public function home(Request $request)
{
/** @var User $user */
$user = auth()->user();
$doesHaveCategories = $user->categories->isNotEmpty();
$doesHaveCities = $user->cities->isNotEmpty();
$events = Event::approved()->with(['dateArray', 'channel', 'categories', 'eventLocation'])
->whereHas('dateArray', function (Builder $query) use ($request) {
if (empty($request->type) || $request->type !== 'past') {
<label for="uploadAvatar" class="absolute bottom-[-10px] right-[-10px] bg-violet-700 rounded-full w-8 h-8 flex justify-center items-center">
<svg class="fill-white w-5 h-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M144 288C144 226.1 194.1 176 256 176C317.9 176 368 226.1 368 288C368 349.9 317.9 400 256 400C194.1 400 144 349.9 144 288zM256 208C211.8 208 176 243.8 176 288C176 332.2 211.8 368 256 368C300.2 368 336 332.2 336 288C336 243.8 300.2 208 256 208zM362.9 64.82L373.3 96H448C483.3 96 512 124.7 512 160V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V160C0 124.7 28.65 96 64 96H138.7L149.1 64.82C155.6 45.22 173.9 32 194.6 32H317.4C338.1 32 356.4 45.22 362.9 64.82H362.9zM64 128C46.33 128 32 142.3 32 160V416C32 433.7 46.33 448 64 448H448C465.7 448 480 433.7 480 416V160C480 142.3 465.7 128 448 128H
isCrossViewport(id) {
const rect = document.getElementById(id).getBoundingClientRect()
console.log('rect.top', rect.top)
console.log('rect.bottom', rect.bottom)
console.log('window.innerHeight', window.innerHeight)
console.log(
'document.documentElement.clientHeight',
document.documentElement.clientHeight
)
return rect.bottom <= window.innerHeight