Skip to content

Instantly share code, notes, and snippets.

View chrispian's full-sized avatar

Chrispian chrispian

View GitHub Profile
@chrispian
chrispian / PreventOnProduction.php
Created February 18, 2025 14:28
Laravel - Prevent Command Execution on Production
<?php
/*
*
* USAGE: Add PreventOnProduction trait to your command. By default
* this will prevent the command from being run on production environments.
*
* OPTIONAL: Override the default by definining the $prohibitedEnvironments array.
* eg: $prohibitedEnvironments = ['prodcution', 'staging'];
*
@chrispian
chrispian / laravel-queue-oddities.md
Created January 23, 2025 23:33
HELP NEEDED: Laravel Jobs Running When Queues Are Stopped and Old Code Is Being Run

I'm on a project at work and running into a very weird problem. The issues are:

  • Even when I stop supervisor and queue a job, the job gets executed
  • The job fails and in the stacktrace the exception caught is OLD code. I modified a vendor file as part of debubbing another problem and the new verbiage for the exception (line 288). I changed the verbiage and moved the exeption to another line but it still shows line 288 in the failed jobs log

Things We've Tried

  • Cleared all caches (opcode, config, route, view, Laravel, and composer caches).
  • Restarted PHP-FPM.
  • Restarted queue workers and supervisor.
@chrispian
chrispian / filament-access-parent-data-from-modal.php
Last active October 25, 2024 03:06
Get data from the parent form and display it a modal/slide over.
<?php
/*
I have a feeling I've overcomplicated something
that should be simple. Help me out.
What I'm trying to do is create a modal/slidover.
It's going to be a debug window for a complex form.
- It will include the current values at the top.
@chrispian
chrispian / getPosts.php
Last active September 27, 2024 18:34
Import WordPress posts, categories, and tags to a Laravel table
<?php
/*
* NOTES:
*
* - This was designed for my personal use and could be more robust.
* - Make sure to update the tables you want to import into.
* - Make sure to update the website url you want to import from.
* - Customize as needed. I had very few posts and no media.
*
*/
@chrispian
chrispian / custom-header.blade.php
Last active May 22, 2024 16:40
Custom Widget Display
<x-filament::section
collapsible
collapsed
persist-collapsed
compact
id="case-log-widgets"
col-span-3
>
<x-slot name="heading">
Stats
@chrispian
chrispian / BlockSettings.php
Created November 17, 2022 16:59 — forked from awcodes/BlockSettings.php
Filament Block Settings
<?php
namespace App\Forms\Components;
use Filament\Forms\Components\Group;
class BlockSettings extends Group
{
protected string $view = 'filament.forms.components.block-settings';
@chrispian
chrispian / FilamentCardTableLayout.php
Created November 17, 2022 16:50 — forked from AAbosham/FilamentCardTableLayout.php
Filament Card Table Layout
<?php
namespace App\Filament\Resources\Trip;
//...
class PlaceResource extends Resource
{
public static function table(Table $table): Table
{
return $table
The error is for resource/views/layouts/guest.blade.php:14 require and here are the contents. It's the @vite line
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
@chrispian
chrispian / gravityforms_disable_tab_index
Created March 26, 2021 23:06
Disable automatic tab indexing as it often causes problems
`add_filter( 'gform_tabindex', '__return_false' );`
// Disable automatic tab indexing as it often causes problems - via Jeffrey @ WebDevStudios