Skip to content

Commit

Permalink
[UPDATE] get assign by id
Browse files Browse the repository at this point in the history
  • Loading branch information
shuikang committed Mar 28, 2018
1 parent 2653a64 commit d841306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Http/Controllers/AssignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public function __construct(AssignRepositoryInterface $assign) {
$this->assignRepo = $assign;
}

public function getAssign($assignId) {
$data = $this->assignRepo->getAssign($assignId);
return json_encode($data);
}

public function getByProblemId($problemId) {
$data = $this->assignRepo->getByProblemId($problemId);
return json_encode($data);
Expand Down
5 changes: 5 additions & 0 deletions app/Repositories/AssignRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
use App\Models\Assign;

class AssignRepository implements AssignRepositoryInterface {
public function getAssign($assignId) {
$data = Assign::find($assignId);
return $data;
}

public function getByProblemId($problemId) {
$data = Assign::where('problem_id', $problemId)->get();
return $data;
Expand Down
1 change: 1 addition & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
});

Route::prefix('/assigns')->group(function () {
Route::get('/{id}', 'AssignController@getAssign');
Route::get('/problem_id/{id}', 'AssignController@getByProblemId');
Route::get('/role_team_id/{id}', 'AssignController@getByRoleTeamId');
Route::get('/assigned_id/{id}', 'AssignController@getByAssignedId');
Expand Down

0 comments on commit d841306

Please sign in to comment.