Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Mar 14, 2024. It is now read-only.
/quicksandPublic archive

Easily schedule regular cleanup of old soft-deleted Eloquent data.

License

NotificationsYou must be signed in to change notification settings

tighten/quicksand

Repository files navigation

Quicksand logo

Quicksand

Tests

Schedule a force delete of your soft deleted Eloquent models or pivot tables after they've been soft deleted for a given period of time.

Quicksand is an Artisan command that you can run in your scheduler daily.

Requirements

  • If you are using Laravel 5.6 or higher, use version2.0 of this package.
  • If you are using Laravel 5.5 and running PHP 7.1 or higher, use version1.0 of this package.
  • If you are using Laravel 5.4 or lower, or PHP 7.0 or lower, please use version0.2 of this package.

Installation

  1. Add Quicksand to your Composer file:composer require tightenco/quicksand

  2. Register the Quicksand Service provider inconfig/app.php (you can skip this step if you're using Laravel 5.5 or higher due to package auto-discovery):

    'providers' => [    ...Tightenco\Quicksand\QuicksandServiceProvider::class,
  3. Publish your config:php artisan vendor:publish --provider="Tightenco\Quicksand\QuicksandServiceProvider"

  4. Edit your config. Define which classes and/or pivot tables you'd like to have Quicksand clean up for you, how many days Quicksand should wait to clean up, and whether or not the results should be logged. The default'days' until cleaning up is overridable by specifying a'days' key when registering a model or pivot table:

    1. Note: Quicksand will disregard any global scopes applied to models when deleting.
    2. Note: Prior to version 2.3 thedeletables configuration key was namedmodels and did not support pivot tables.
    'days' =>30,'deletables' => [App\Default::class,App\CleanEveryTwentyDays::class => ['days'  =>20// override default 'days'    ],'example_pivot','example_pivot' => ['days'  =>20// override default 'days'    ]]
  5. Schedule the command inapp/Console/Kernel.php:

    protectedfunctionschedule(Schedule$schedule){$schedule->command('quicksand:run')        ->daily();}

Using a Custom Log File

If you are using Laravel 5.6 or higher, you can customize the logger Quicksand uses by adding aquicksand channel to yourlogging.php config file like so:

'channels' => [/* ... */'quicksand' => ['driver' =>'single','path' =>storage_path('logs/quicksand.log'),'level' =>'info',    ],]

If you are using Laravel 5.5 or lower, you can customize the logger Quicksand uses by editing thecustom_log_file option in yourquicksand.php config file.

By default, Quicksand will log to the standardlaravel.log file.

Versioning

We useSemVer for versioning. For the versions available, see thetags on this repository.

Authors

See also the list ofcontributors who participated in this project.

This package is developed and maintained byTighten.

Testing

You can test this package by running

composer test

License

This project is licensed under the MIT License - see theLICENSE.md file for details


[8]ページ先頭

©2009-2025 Movatter.jp