コード例 #1
0
ファイル: AddCommit.php プロジェクト: funivan/ci
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $commit = new Commit();
     $commit->status = Commit::STATUS_PENDING;
     $commit->branch = $this->argument('branch');
     $commit->hash = $this->argument('hash');
     $commit->start_time = time();
     $commit->end_time = 0;
     $commit->save();
     $this->getOutput()->writeln('Added. Id: ' . $commit->id);
 }
コード例 #2
0
ファイル: CommitController.php プロジェクト: funivan/ci
 /**
  * @return \Illuminate\Contracts\Routing\ResponseFactory
  */
 public function addCommit()
 {
     $commit = new Commit();
     $commit->status = Commit::STATUS_PENDING;
     $commit->hash = request('hash');
     $commit->branch = request('branch');
     $commit->profile = request('profile', '');
     $commit->start_time = time();
     $commit->end_time = 0;
     $commit->save();
     return response(['id' => $commit->id]);
 }
コード例 #3
0
ファイル: Commits.php プロジェクト: funivan/ci
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 0; $i < 10; $i++) {
         $faker = Factory::create();
         $commit = new Commit();
         $commit->status = $faker->randomElement([Commit::STATUS_PENDING, Commit::STATUS_OK, Commit::STATUS_IN_PROGRESS, Commit::STATUS_FAILURE]);
         $commit->hash = $faker->hexColor;
         $commit->branch = $faker->randomElement(['master', 'u-text']);
         $commit->profile = $faker->randomElement(['test', 'consistency', '']);
         $commit->author_email = $faker->email;
         $commit->start_time = $faker->unixTime;
         $commit->message = $faker->realText(random_int(10, 60));
         $commit->end_time = $faker->unixTime;
         $commit->save();
     }
 }