Repository navigation
Add table and model config options - #22
Open
guiribmedeiros wants to merge 1 commit into
Open
guiribmedeiros wants to merge 1 commit into
guiribmedeiros wants to merge 1 commit into
Conversation
Adds `table` and `model` config options so recordings can be stored in a custom table and recorded through a custom model that extends the default Barstool model. Defaults match the current behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
@craigpotter may I ask you for a review? great tools btw! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview of change
Adds two config options so Barstool can follow an app's own naming conventions.
table: the table recordings are stored in. Defaults tobarstools. The model and all three migration stubs use it.model: the model recordings are written through, both inline and from the queued job. Defaults toSaloon\Barstool\Models\Barstool. A custom model must extend it, and it gets the configuredtableautomatically. Without that, Eloquent would infersaloon_logsfrom aSaloonLogsubclass.This is fully backwards compatible. The defaults match current behaviour, and a published config without these keys falls back to the same defaults. Migrations that are already published are untouched.
A few notes:
Barstool::getModelClass(). It is marked@internalso it doesn't add to the public API.add_created_at_indexupgrade migration now looks for an existing index by column (hasIndex($table, ['created_at'])) instead of by the generatedbarstools_created_at_indexname. That way the check works for any table name.is_a()guard if you'd prefer one.Testing
Four new tests:
All four fail without the change. Full suite: 51 passed (196 assertions) on Laravel 13 and Laravel 12. PHPStan level 8 and Pint are both clean. The branch also merges cleanly with #21.
🤖 Generated with Claude Code