-
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.
* master: Small copy changes Added missing delete option Added missing docblock Silence PHPMD warning about number of children Manage environmental variables. Added missing newline Clean up some StyleCI violations Added UI to manage variables Tweak DB seeder Adding environmental variables for #133 and #108 Updated dependencies
- Loading branch information
Showing
23 changed files
with
614 additions
and
75 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace REBELinBLUE\Deployer\Http\Controllers\Resources; | ||
|
||
use Illuminate\Support\Facades\Input; | ||
use REBELinBLUE\Deployer\Http\Requests; | ||
use REBELinBLUE\Deployer\Http\Requests\StoreVariableRequest; | ||
use REBELinBLUE\Deployer\Repositories\Contracts\VariableRepositoryInterface; | ||
|
||
/** | ||
* Variable management controller. | ||
*/ | ||
class VariableController extends ResourceController | ||
{ | ||
/** | ||
* Class constructor. | ||
* | ||
* @param VariableRepositoryInterface $repository | ||
* @return void | ||
*/ | ||
public function __construct(VariableRepositoryInterface $repository) | ||
{ | ||
$this->repository = $repository; | ||
} | ||
|
||
/** | ||
* Store a newly created variable in storage. | ||
* | ||
* @param StoreVariableRequest $request | ||
* @return Response | ||
*/ | ||
public function store(StoreVariableRequest $request) | ||
{ | ||
return $this->repository->create($request->only( | ||
'name', | ||
'value', | ||
'project_id' | ||
)); | ||
} | ||
|
||
/** | ||
* Update the specified variable in storage. | ||
* | ||
* @param int $variable_id | ||
* @param StoreVariableRequest $request | ||
* @return Response | ||
*/ | ||
public function update($variable_id, StoreVariableRequest $request) | ||
{ | ||
return $this->repository->updateById($request->only( | ||
'name', | ||
'value', | ||
'project_id' | ||
), $variable_id); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace REBELinBLUE\Deployer\Http\Requests; | ||
|
||
use REBELinBLUE\Deployer\Http\Requests\Request; | ||
|
||
/** | ||
* Request for validating variables. | ||
*/ | ||
class StoreVariableRequest extends Request | ||
{ | ||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
'name' => 'required|max:255', | ||
'value' => 'required', | ||
'project_id' => 'required|integer|exists:projects,id', | ||
]; | ||
} | ||
} |
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
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
11 changes: 11 additions & 0 deletions
11
app/Repositories/Contracts/VariableRepositoryInterface.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,11 @@ | ||
<?php | ||
|
||
namespace REBELinBLUE\Deployer\Repositories\Contracts; | ||
|
||
interface VariableRepositoryInterface | ||
{ | ||
public function getAll(); | ||
public function create(array $fields); | ||
public function updateById(array $fields, $model_id); | ||
public function deleteById($model_id); | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace REBELinBLUE\Deployer\Repositories; | ||
|
||
use REBELinBLUE\Deployer\Variable; | ||
use REBELinBLUE\Deployer\Repositories\Contracts\VariableRepositoryInterface; | ||
use REBELinBLUE\Deployer\Repositories\EloquentRepository; | ||
|
||
/** | ||
* The variable repository. | ||
*/ | ||
class EloquentVariableRepository extends EloquentRepository implements VariableRepositoryInterface | ||
{ | ||
/** | ||
* Class constructor. | ||
* | ||
* @param Variable $model | ||
* @return EloquentVariableRepository | ||
*/ | ||
public function __construct(Variable $model) | ||
{ | ||
$this->model = $model; | ||
} | ||
} |
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,39 @@ | ||
<?php | ||
|
||
namespace REBELinBLUE\Deployer; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
use REBELinBLUE\Deployer\Traits\BroadcastChanges; | ||
|
||
/** | ||
* Model for environmental variables. | ||
*/ | ||
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'); | ||
} | ||
} |
Oops, something went wrong.