Download the PHP package laracraft-tech/laravel-useful-additions without Composer
On this page you can find all versions of the php package laracraft-tech/laravel-useful-additions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laracraft-tech/laravel-useful-additions
More information about laracraft-tech/laravel-useful-additions
Files in laracraft-tech/laravel-useful-additions
Package laravel-useful-additions
Short Description A collection of useful Laravel additions!
License MIT
Homepage https://github.com/laracraft-tech/laravel-useful-additions
Informations about the package laravel-useful-additions
A collection of useful Laravel additions!
Here we will share some useful Laravel additions we need in our daily work.
Traits
UsefulEnums
UsefulScopes
selectAllBut
fromToday
fromYesterday
RefreshDatabaseFast
Commands
db:truncate
Installation
You can install the package via composer:
Then publish the config file with:
Traits
UsefulEnums
This trait is only available with PHP 8.1 or higher installed.
names
, values
, array
This could be very handy if you like to loop over all of your enum types, or you maybe want to use the enum as an array, for instance in a migration.
UsefulScopes
selectAllBut
Select all columns but given excluded array.
Note: Since you can't do a native "select all but x,y,z" in mysql, we need to query (and cache) the existing columns of the table, and then exclude the given columns which should be ignored (not selected) from the existing columns.
Cache: Column names of each table will be cached until contents of migrations directory is added or deleted. Modifying the contents of files inside the migrations directory will not re-cache the columns. Consider to clear the cache whenever you make a new deployment/migration!
fromToday
, fromYesterday
Select all entries created today or yesterday.
RefreshDatabaseFast
This is a trait which makes the migration of your database in your test suite much, much faster!
The base idea comes from Mayahi.
It basically only migrates your database if the migration files has changed.
So the first migrate:fresh
takes a while (depending on how many migrations you have), and then it's incredible fast.
Optionally you can set USEFUL_ADDITIONS_SEED_AFTER_FAST_DB_REFRESH
to true
if you like to seed your database after the migration.
Also make sure to add the .phpunit.database.checksum
to your .gitignore
file!
Pest:
PHPUnit:
Commands
db:truncate
This command truncates all the tables of your current database connection. Checkout --help
to see arguments and options.
It for instance, lets you also truncate only specific tables or disable foreigen key checks or maybe run in force mode.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Zacharias Creutznacher
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-useful-additions with dependencies
illuminate/database Version ^9.0 || ^10.0 || ^11.0
illuminate/support Version ^9.0 || ^10.0 || ^11.0
illuminate/testing Version ^9.0 || ^10.0 || ^11.0
illuminate/contracts Version ^9.0 || ^10.0 || ^11.0
spatie/laravel-package-tools Version ^1.12 || ^1.14