PHP 8.3.31
Preview: Prunable.php Size: 1.44 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Prunable.php

<?php

namespace Illuminate\Database\Eloquent;

use Illuminate\Database\Events\ModelsPruned;
use LogicException;

trait Prunable
{
    /**
     * Prune all prunable models in the database.
     *
     * @param  int  $chunkSize
     * @return int
     */
    public function pruneAll(int $chunkSize = 1000)
    {
        $total = 0;

        $this->prunable()
            ->when(in_array(SoftDeletes::class, class_uses_recursive(static::class)), function ($query) {
                $query->withTrashed();
            })->chunkById($chunkSize, function ($models) use (&$total) {
                $models->each->prune();

                $total += $models->count();

                event(new ModelsPruned(static::class, $total));
            });

        return $total;
    }

    /**
     * Get the prunable model query.
     *
     * @return \Illuminate\Database\Eloquent\Builder<static>
     */
    public function prunable()
    {
        throw new LogicException('Please implement the prunable method on your model.');
    }

    /**
     * Prune the model in the database.
     *
     * @return bool|null
     */
    public function prune()
    {
        $this->pruning();

        return in_array(SoftDeletes::class, class_uses_recursive(static::class))
                ? $this->forceDelete()
                : $this->delete();
    }

    /**
     * Prepare the model for pruning.
     *
     * @return void
     */
    protected function pruning()
    {
        //
    }
}

Directory Contents

Dirs: 5 × Files: 23

Name Size Perms Modified Actions
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Casts DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Concerns DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Factories DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Relations DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
3.26 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
5.73 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
348 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
61.52 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
22.64 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.60 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.37 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
930 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.36 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
137 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.18 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
564 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
63.61 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
13.30 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.39 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
4.59 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.44 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
677 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1001 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
350 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
7.76 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
4.73 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).