28 lines
520 B
PHP
Executable File
28 lines
520 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use App\Models\Product;
|
|
|
|
class MassAction
|
|
{
|
|
public function massDelete(array $attributes)
|
|
{
|
|
Product::whereIn('id', $attributes)->delete();
|
|
}
|
|
|
|
public function massUnpublish(array $attributes)
|
|
{
|
|
Product::whereIn('id', $attributes)->update([
|
|
'published' => false
|
|
]);
|
|
}
|
|
|
|
public function massPublish(array $attributes)
|
|
{
|
|
Product::whereIn('id', $attributes)->update([
|
|
'published' => true
|
|
]);
|
|
}
|
|
}
|