Skip to content

Instantly share code, notes, and snippets.

View whoisthisstud's full-sized avatar

The Lincster whoisthisstud

View GitHub Profile
@whoisthisstud
whoisthisstud / LaravelWhereLikeMacro.php
Created October 10, 2025 03:09 — forked from MrPunyapal/LaravelWhereLikeMacro.php
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
{
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Stripe\Stripe;
class PaymentController extends Controller {
public function index() {
return view('test-payment');
@whoisthisstud
whoisthisstud / before-after-slider.blade.php
Created January 18, 2025 03:46
AlpineJS Before/After Image Slider Component
{{-- Before/After Blade Component --}}
@props([
'before_image' => null,
'after_image' => null
])
<div
x-data="beforeAfterSlider('{{ $before_image }}', '{{ $after_image }}')"
x-ref="sliderContainer"
class="relative w-full h-full aspect-video overflow-hidden select-none"
@whoisthisstud
whoisthisstud / AlpineNotificationsComponent.php
Last active September 2, 2024 05:11
AlpineJS Notification
public function myfunction()
{
// ...other code
$route = route('dashboard');
$this->dispatch('notify', type: 'success', title: 'You did it!'); // minimum
$this->dispatch('notify', type: 'success', title: 'You did it!', content: 'This is your reward'); // additional text
$this->dispatch('notify', type: 'success', title: 'You did it!', content: 'This is your reward', route: $route, target: '_blank'); // include a route
// ...remainder of code
@whoisthisstud
whoisthisstud / Http\Livewire\Dashboard.php
Last active February 25, 2024 16:30
Laravel Livewire "Dashboard" component + PeriodScopesTrait for dynamic model metric cards
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Dashboard extends Component
{
/**
* The selected period
@whoisthisstud
whoisthisstud / ChatGPTService.php
Created January 11, 2023 17:28
ChatGPT written Laravel Service class for interacting with ChatGPT's API.
<?php
namespace App\Services;
use GuzzleHttp\Client;
class ChatGPTService
{
private $apiKey;
private $baseUrl;
@whoisthisstud
whoisthisstud / AdminDashboard.php
Last active April 7, 2023 18:04
Laravel Custom Model Period Metrics
<?php
namespace App\Http\Livewire\Dashboards;
use Livewire\Component;
class AdminDashboard extends Component
{
public $period = 'Year'; // default: Year. options: Today, Week, Month, Quarter, Year, 'All Time'
@whoisthisstud
whoisthisstud / App\Http\Kernal.php
Last active November 2, 2022 19:48
HasOnlineStatus feature
// Include the UserOnline::class in the $middlewareGroups array.
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
@whoisthisstud
whoisthisstud / Models\Bookmark.php
Last active September 26, 2024 21:10
Laravel Bookmarking Traits
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Bookmark extends Model
{
use HasFactory;
@whoisthisstud
whoisthisstud / .gitignore
Created September 20, 2022 05:34 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #