Skip to content

Instantly share code, notes, and snippets.

View chrispian's full-sized avatar

Chrispian chrispian

View GitHub Profile
@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 / 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 / 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 / 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'];
*