Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 9 |
| DeletedUserInUserDetail | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 9 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| handle | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 7 |
|||
| <?php | |
| namespace App\Console\Commands; | |
| use Illuminate\Console\Command; | |
| use Carbon\Carbon; | |
| use App\Models\Auth\User; | |
| use App\Models\Admin\UserDetail; | |
| use Illuminate\Support\Facades\Log; | |
| class DeletedUserInUserDetail extends Command | |
| { | |
| /** | |
| * The name and signature of the console command. | |
| * | |
| * @var string | |
| */ | |
| protected $signature = 'user:deleted'; | |
| /** | |
| * The console command description. | |
| * | |
| * @var string | |
| */ | |
| protected $description = 'user will also delete in user_details table'; | |
| /** | |
| * Create a new command instance. | |
| * | |
| * @return void | |
| */ | |
| public function __construct() | |
| { | |
| parent::__construct(); | |
| } | |
| /** | |
| * Execute the console command. | |
| * | |
| * @return mixed | |
| */ | |
| public function handle() | |
| { | |
| $users = User::onlyTrashed()->get(); | |
| foreach($users as $user){ | |
| UserDetail::where('user_id', $user->id)->update(['deleted_at' => $user->deleted_at ]); | |
| $deleted_at = $user->deleted_at; | |
| Log::info('users : ' .$user); | |
| } | |
| Log::info('success'); | |
| } | |
| } |