-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
3b56b60
commit e2d12c0
Showing
6 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace REBELinBLUE\Deployer; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
use REBELinBLUE\Deployer\Traits\BroadcastChanges; | ||
|
||
|
||
class Variable extends Model | ||
{ | ||
use SoftDeletes, BroadcastChanges; | ||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = ['name', 'value', 'project_id']; | ||
|
||
/** | ||
* The attributes excluded from the model's JSON form. | ||
* | ||
* @var array | ||
*/ | ||
protected $hidden = ['created_at', 'updated_at', 'deleted_at']; | ||
|
||
/** | ||
* Belongs to relationship. | ||
* | ||
* @return Project | ||
*/ | ||
public function project() | ||
{ | ||
return $this->belongsTo('REBELinBLUE\Deployer\Project'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
database/migrations/2015_12_31_144850_create_variables_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateVariablesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('variables', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->string('name'); | ||
$table->string('value'); | ||
$table->unsignedInteger('project_id'); | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
$table->foreign('project_id')->references('id')->on('projects'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('variables'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Seeder; | ||
use REBELinBLUE\Deployer\Variable; | ||
|
||
class VariableTableSeeder extends Seeder | ||
{ | ||
public function run() | ||
{ | ||
DB::table('variables')->delete(); | ||
|
||
Variable::create([ | ||
'project_id' => 1, | ||
'name' => 'COMPOSER_TIMEOUT', | ||
'value' => '500' | ||
]); | ||
} | ||
} |