Skip to content

Instantly share code, notes, and snippets.

View neverything's full-sized avatar
🍀
Good vibes for you

Silvan Hagen neverything

🍀
Good vibes for you
View GitHub Profile
<?php
use App\Filament\Resources\MilestoneResource;
use App\Filament\Resources\TaskResource;
use Filament\Navigation\NavigationBuilder;
use Filament\Navigation\NavigationGroup;
use Filament\Navigation\NavigationItem;
use Filament\Panel;
public function panel(Panel $panel): Panel
<?php
namespace App\Models;
use AshAllenDesign\FaviconFetcher\Facades\Favicon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Storage;
<?php
use AshAllenDesign\FaviconFetcher\Facades\Favicon;
// Returns my twitter avatar
Favicon::driver("unavatar-services")
->fetch("https://x.com/neverything");
// Returns my github profile avatar
Favicon::driver("unavatar-services")
<?php
namespace App\Providers;
use App\FaviconFetcher\Drivers\UnavatarServices;
use AshAllenDesign\FaviconFetcher\Facades\Favicon;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
<?php
declare(strict_types=1);
namespace App\FaviconFetcher\Drivers;
use AshAllenDesign\FaviconFetcher\Collections\FaviconCollection;
use AshAllenDesign\FaviconFetcher\Concerns\HasDefaultFunctionality;
use AshAllenDesign\FaviconFetcher\Concerns\MakesHttpRequests;
use AshAllenDesign\FaviconFetcher\Concerns\ValidatesUrls;
@neverything
neverything / User.php
Last active June 16, 2024 19:50
Filament: Get default tenant when using Jetstream https://silvanhagen.com/writing/filament-get-default-tenant-for-user/
<?php
class User extends Authenticatable implements HasDefaultTenant // and more stuff like FilamentUser, HasTenants, ...
{
public function getDefaultTenant(Panel $panel): ?Model
{
return $this->currentTeam ?? $this->allTeams()->first();
}
}
function c() {
return {
collapsedGroups: [],
isLoading: !1,
selectedRecords: [],
shouldCheckUniqueSelection: !0,
lastChecked: null, // Add a variable to keep track of the last checked checkbox
init: function () {
this.$wire.$on("deselectAllTableRecords", () => this.deselectAllRecords()),
this.$watch("selectedRecords", () => {
@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(