migrate - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of migrate.php
- <?php
- use Illuminate\Database\Migrations\Migration;
- use TIM\Models\CronJob;
- use TIM\Models\EmergencyNumber;
- use TIM\Modules\CronJob\Helper\CronJobString;
- class CreateCronjobEmergencyLogs extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- // If emergency number exists, create cron job
- if (EmergencyNumber::count() > 0) {
- $cronJob = new CronJob();
- $cronJob->class = CronJob::DELETE_EMERGENCY_LOGS_JOB_CLASS;
- $cronJob->payload = [];
- $cronJob->cron = app(CronJobString::class)->buildCron(CronJobString::TYPE_DAILY, "5", 0, 0);
- $cronJob->enabled = true;
- $cronJob->system = true;
- $cronJob->save();
- }
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- if (CronJob::where("class", CronJob::DELETE_EMERGENCY_LOGS_JOB_CLASS)->count() > 0) {
- CronJob::where('class', CronJob::DELETE_EMERGENCY_LOGS_JOB_CLASS)->delete();
- }
- }
- }
File Description
- migrate
- PHP Code
- 24 Jun-2019
- 1.06 Kb
You can Share it:
Latest PHP Pastes