Skip to content

Instantly share code, notes, and snippets.

View neverything's full-sized avatar

Silvan Hagen neverything

View GitHub Profile
@neverything
neverything / AppServiceProvider.php
Last active December 16, 2023 14:14
Handle free users with Filament and Laravel Spark using a custom Middleware. Learn more: https://silvanhagen.com/free-users-filament-laravel-spark/
<?php
// namespace and more...
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
// Bind our implementation
$this->app->bind(
@neverything
neverything / VerifyProjectIsBillable.php
Created December 16, 2023 14:02
Extending the Filament Middleware to verify if a tenant is billable. Read more and learn an even better way: https://silvanhagen.com/free-users-filament-laravel-spark/
<?php
namespace App\Http\Middleware;
use Filament\Billing\Providers\Http\Middleware\VerifySparkBillableIsSubscribed;
use Filament\Facades\Filament;
class VerifyProjectIsBillable extends VerifySparkBillableIsSubscribed
{
public function handle($request, $next, $subscription = 'default', $plan = null)
@neverything
neverything / FeedbackResource.php
Created December 16, 2023 13:51
⚠️ Don't do it this way. Read about it on my blog https://silvanhagen.com/free-users-filament-laravel-spark/
<?php
namespace App\Filament\Resources;
// use ...
class FeedbackResource extends Resource
{
// ... rest of the class
<?php
// Custom HasPagination interface
namespace App\Http\Integrations\GithubApi\Contracts;
use Saloon\Http\Request;
use Saloon\PaginationPlugin\Paginator;
interface HasPagination
<head>
<meta property="og:image" content="https://wireinthewild.com/storage/share/mailcoach.png">
<meta name="twitter:image" content="https://wireinthewild.com/storage/share/mailcoach.png">
</head>
<?php
namespace App\Listeners;
use App\Events\ProjectPublishedEvent;
use App\Models\Project;
use Illuminate\Support\Facades\Artisan;
class RunGenerateShareImageCommand
{
<?php
namespace App\Console\Commands;
use App\Models\Project;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
use Spatie\Browsershot\Browsershot;
class GenerateOpenGraphImage extends Command
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="scroll-smooth">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>{{ $project->name }} | Share Image</title>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">