Skip to content

Instantly share code, notes, and snippets.

View iammuttaqi's full-sized avatar
🏠
Working from home

Muttaqi iammuttaqi

🏠
Working from home
View GitHub Profile
@MrPunyapal
MrPunyapal / HasLabel.md
Last active January 18, 2024 16:00
Enhance Laravel Enums with Human-Friendly Labels using HasLabel Trait

HasLabel.php Trait

namespace App\Concerns\Enums;
 
trait HasLabel
{
    public function label(): string
    {
        return str($this->name)
@MrPunyapal
MrPunyapal / LivewireTeleportGlitch.md
Last active January 17, 2024 16:04
Solution to pesky @teleport glitch during compilation!

Teleport diractive issue

If you encounter caching issues with your @teleport Livewire/Blade directive after running php artisan view:cache, you may notice problems appearing instead of the expected compilation.

image

To resolve this issue, manually add compilation to the Blade directive.

class AppServiceProvider extends ServiceProvider
@MrPunyapal
MrPunyapal / GenerateUniqueSlug.php
Created November 29, 2023 16:40
Efficient Laravel Slug Generation: Unique, Sleek, and No Looping 🚀
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Blog extends Model
{
@iammuttaqi
iammuttaqi / ImageCropper.php
Last active November 8, 2023 22:14
TALL stack image cropper using CropperJs (daisy ui as tailwind framework)
<?php
namespace App\Http\Livewire\Components;
use Livewire\Attributes\Modelable;
use Livewire\Component;
class ImageCropper extends Component
{
#[Modelable]
@MrPunyapal
MrPunyapal / LaravelWhereLikeMacro.php
Last active August 5, 2024 08:24
Laravel Custom 'whereLike' Macro for Dynamic 'LIKE' Searches including relationships
<?php
namespace App\Providers;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
<script setup>
import { useStorage } from "@/composables/useStorage";
let food = useStorage('food', 'tacos');
</script>
<template>
<main>
<p>
What is your favorite food? <input type="text" v-model="food">
@nagavinodcse
nagavinodcse / alpinejs-carousel-using-swiper-tailwindcss.markdown
Created December 25, 2020 15:59
AlpineJS Carousel using Swiper + Tailwindcss
@theanam
theanam / regex.txt
Last active March 5, 2025 01:02
Regular Expression to match Bangladeshi Phone number. Also returns the number as E.164 Format as first group match
/^(?:\+88|88)?(01[3-9]\d{8})$/

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

@matthewzring
matthewzring / markdown-text-101.md
Last active April 15, 2025 10:18
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers: