Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 16 |
| Updatescheduleuserid | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
56 | |
0.00% |
0 / 16 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| handle | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 14 |
|||
| <?php | |
| namespace App\Console\Commands; | |
| use Illuminate\Console\Command; | |
| use Illuminate\Support\Facades\Log; | |
| use App\Exceptions\Handler; | |
| use App\Models\Auth\User; | |
| use App\Models\Admin\UserDetail; | |
| use App\Models\Schedule\ScheduleDetail; | |
| class Updatescheduleuserid extends Command | |
| { | |
| /** | |
| * The name and signature of the console command. | |
| * | |
| * @var string | |
| */ | |
| protected $signature = 'scheduleuserid:update'; | |
| /** | |
| * The console command description. | |
| * | |
| * @var string | |
| */ | |
| protected $description = 'Update user id in scheduledetails'; | |
| /** | |
| * Create a new command instance. | |
| * | |
| * @return void | |
| */ | |
| public function __construct() | |
| { | |
| parent::__construct(); | |
| } | |
| /** | |
| * Execute the console command. | |
| * | |
| * @return mixed | |
| */ | |
| public function handle() | |
| { | |
| //$users = User::all(); | |
| try { | |
| $schedule = ScheduleDetail::where('is_active','=','1') | |
| ->get(); | |
| /* print_r($schedule); | |
| exit;*/ | |
| if(isset($schedule) && !empty($schedule)) | |
| { | |
| foreach ($schedule as $value) { | |
| $userdetail = UserDetail::select('user_id') | |
| ->where('id','=',$value->user_id) | |
| ->withTrashed() | |
| ->first(); | |
| if(isset($userdetail->user_id)) | |
| { | |
| $update = ScheduleDetail::where('id','=',$value->id) | |
| ->update(['user_id' => $userdetail->user_id]); | |
| } | |
| } | |
| } | |
| return; | |
| } | |
| catch (Throwable $e) | |
| { | |
| return; | |
| } | |
| } | |
| } |