@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Display a listing of the resource. |
| 28 | 28 | * |
| 29 | - * @return \Illuminate\Http\Response |
|
| 29 | + * @return \Illuminate\Http\JsonResponse |
|
| 30 | 30 | */ |
| 31 | 31 | public function index() |
| 32 | 32 | { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * Display the specified resource. |
| 69 | 69 | * |
| 70 | 70 | * @param int $id |
| 71 | - * @return \Illuminate\Http\Response |
|
| 71 | + * @return \Illuminate\Http\JsonResponse |
|
| 72 | 72 | */ |
| 73 | 73 | public function show($id) |
| 74 | 74 | { |
@@ -3,8 +3,6 @@ |
||
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use Illuminate\Http\Request; |
| 6 | - |
|
| 7 | -use App\Http\Requests; |
|
| 8 | 6 | use App\Http\Controllers\Controller; |
| 9 | 7 | use App\Tag; |
| 10 | 8 | use App\Http\Transformers\TagTransformer; |
@@ -73,12 +73,12 @@ |
||
| 73 | 73 | public function show($id) |
| 74 | 74 | { |
| 75 | 75 | $tag = Tag::find($id); |
| 76 | - if(!$tag){ |
|
| 76 | + if (!$tag) { |
|
| 77 | 77 | return response() -> json([ |
| 78 | 78 | "msg" => "does not exist" |
| 79 | 79 | ], 404 |
| 80 | 80 | ); |
| 81 | - }else{ |
|
| 81 | + } else { |
|
| 82 | 82 | return response() -> json([ |
| 83 | 83 | "msg" => "Success", |
| 84 | 84 | "tag" => $this->TagTransformer->transform($tag) |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | "msg" => "does not exist" |
| 79 | 79 | ], 404 |
| 80 | 80 | ); |
| 81 | - }else{ |
|
| 81 | + } else{ |
|
| 82 | 82 | return response() -> json([ |
| 83 | 83 | "msg" => "Success", |
| 84 | 84 | "tag" => $this->TagTransformer->transform($tag) |
@@ -3,8 +3,6 @@ |
||
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use Illuminate\Http\Request; |
| 6 | - |
|
| 7 | -use App\Http\Requests; |
|
| 8 | 6 | use App\Task; |
| 9 | 7 | use App\Http\Controllers\Controller; |
| 10 | 8 | use App\Http\Transformers\TaskTransformer; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public function __construct(TaskTransformer $TaskTransformer) |
| 18 | 18 | { |
| 19 | - $this->TaskTransformer = $TaskTransformer; |
|
| 19 | + $this->TaskTransformer = $TaskTransformer; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | public function transformCollection($task) |
| 130 | 130 | { |
| 131 | - return array_map([$this, 'transform'],$task->toArray()); |
|
| 131 | + return array_map([$this, 'transform'],$task->toArray()); |
|
| 132 | 132 | } |
| 133 | 133 | public function transform($task) |
| 134 | 134 | { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function show($id, $task) |
| 74 | 74 | { |
| 75 | 75 | $task = Task::find($id); |
| 76 | - if(!$task){ |
|
| 76 | + if (!$task) { |
|
| 77 | 77 | return response() -> json([ |
| 78 | 78 | "msg" => "does not exist" |
| 79 | 79 | ], 404 |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | public function transformCollection($task) |
| 130 | 130 | { |
| 131 | - return array_map([$this, 'transform'],$task->toArray()); |
|
| 131 | + return array_map([$this, 'transform'], $task->toArray()); |
|
| 132 | 132 | } |
| 133 | 133 | public function transform($task) |
| 134 | 134 | { |
@@ -25,6 +25,6 @@ |
||
| 25 | 25 | protected function schedule(Schedule $schedule) |
| 26 | 26 | { |
| 27 | 27 | $schedule->command('inspire') |
| 28 | - ->hourly(); |
|
| 28 | + ->hourly(); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace App\Http\Transformers; |
| 4 | 4 | |
| 5 | - class TaskTransformer extends Transformer |
|
| 5 | + class TaskTransformer extends Transformer |
|
| 6 | 6 | { |
| 7 | 7 | public function transform($task) |
| 8 | 8 | { |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | abstract class Transformer |
| 6 | 6 | { |
| 7 | - public function transformCollection($items) |
|
| 7 | + public function transformCollection($items) |
|
| 8 | 8 | { |
| 9 | - return array_map([$this, 'transform'],$items->toArray()); |
|
| 9 | + return array_map([$this, 'transform'],$items->toArray()); |
|
| 10 | 10 | } |
| 11 | 11 | public abstract function transform($items); |
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function transformCollection($items) |
| 8 | 8 | { |
| 9 | - return array_map([$this, 'transform'],$items->toArray()); |
|
| 9 | + return array_map([$this, 'transform'], $items->toArray()); |
|
| 10 | 10 | } |
| 11 | 11 | public abstract function transform($items); |
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | | |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -Route::get('/', function () { |
|
| 13 | +Route::get('/', function() { |
|
| 14 | 14 | return view('welcome'); |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | -Route::resource('task','TaskController'); |
|
| 18 | -Route::resource('tag','TagController'); |
|
| 17 | +Route::resource('task', 'TaskController'); |
|
| 18 | +Route::resource('tag', 'TagController'); |
|
| 19 | 19 | |
| 20 | 20 | //API |
| 21 | -Route::get('task','TaskController@index'); |
|
| 22 | -Route::get('task/{id}','TaskController@show'); |
|
| 23 | -Route::post('task','TaskController@store'); |
|
| 24 | -Route::put('task/{id}','TaskController@update'); |
|
| 25 | -Route::delete('task/{id}','TaskController@destroy'); |
|
| 21 | +Route::get('task', 'TaskController@index'); |
|
| 22 | +Route::get('task/{id}', 'TaskController@show'); |
|
| 23 | +Route::post('task', 'TaskController@store'); |
|
| 24 | +Route::put('task/{id}', 'TaskController@update'); |
|
| 25 | +Route::delete('task/{id}', 'TaskController@destroy'); |
|
| 26 | 26 | |
| 27 | -Route::get('tag','TagController@index'); |
|
| 28 | -Route::get('tag/{id}','TagController@show'); |
|
| 29 | -Route::post('tag','TagController@store'); |
|
| 30 | -Route::put('tag/{id}','TagController@update'); |
|
| 31 | -Route::delete('tag/{id}','TagController@destroy'); |
|
| 32 | 27 | \ No newline at end of file |
| 28 | +Route::get('tag', 'TagController@index'); |
|
| 29 | +Route::get('tag/{id}', 'TagController@show'); |
|
| 30 | +Route::post('tag', 'TagController@store'); |
|
| 31 | +Route::put('tag/{id}', 'TagController@update'); |
|
| 32 | +Route::delete('tag/{id}', 'TagController@destroy'); |
|
| 33 | 33 | \ No newline at end of file |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function map(Router $router) |
| 39 | 39 | { |
| 40 | - $router->group(['namespace' => $this->namespace], function ($router) { |
|
| 40 | + $router->group(['namespace' => $this->namespace], function($router) { |
|
| 41 | 41 | require app_path('Http/routes.php'); |
| 42 | 42 | }); |
| 43 | 43 | } |