@@ -34,7 +34,7 @@ |
||
| 34 | 34 | if (config('todobar.enabled', false) === true) { |
| 35 | 35 | $this->app->make('TPaksu\TodoBar\Controllers\TodoBarController'); |
| 36 | 36 | |
| 37 | - $this->app->singleton(DataStorageInterface::class, function () { |
|
| 37 | + $this->app->singleton(DataStorageInterface::class, function() { |
|
| 38 | 38 | $storage = config("todobar.storage.engine", Storage\JSONStorage::class); |
| 39 | 39 | $config = config("todobar.storage.params", ["file" => "items.json"]); |
| 40 | 40 | if (class_exists($storage)) { |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Illuminate\Support\Facades\Route; |
| 4 | 4 | |
| 5 | -Route::group(['prefix' => 'laravel-todobar'], function () { |
|
| 5 | +Route::group(['prefix' => 'laravel-todobar'], function() { |
|
| 6 | 6 | Route::resource('projects', TPaksu\TodoBar\Controllers\TodoBarProjects::class); |
| 7 | 7 | Route::resource('projects.tasks', TPaksu\TodoBar\Controllers\TodoBarTasks::class); |
| 8 | 8 | }); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $response = $next($request); |
| 34 | 34 | |
| 35 | - if($response instanceof Response){ |
|
| 35 | + if ($response instanceof Response) { |
|
| 36 | 36 | $this->todobar->inject($response); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function update(Request $request, $project_id, $task_id) |
| 77 | 77 | { |
| 78 | - if($request->has("status")){ |
|
| 78 | + if ($request->has("status")) { |
|
| 79 | 79 | $request->validate([ |
| 80 | 80 | "status" => "required|boolean" |
| 81 | 81 | ]); |
| 82 | 82 | $update = "completed"; |
| 83 | 83 | $update_key = "status"; |
| 84 | - }else{ |
|
| 84 | + } else { |
|
| 85 | 85 | $request->validate([ |
| 86 | 86 | "content" => "required|string|filled", |
| 87 | 87 | ]); |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | $project = $this->storage->find($project_id); |
| 93 | 93 | |
| 94 | 94 | if ($project) { |
| 95 | - if(isset($project->tasks[$task_id])){ |
|
| 95 | + if (isset($project->tasks[$task_id])) { |
|
| 96 | 96 | |
| 97 | 97 | $project->tasks[$task_id]->{$update} = $request->get($update_key); |
| 98 | 98 | |
| 99 | 99 | $this->storage->update($project_id, $project); |
| 100 | 100 | return response()->json(["status" => "success"], 200); |
| 101 | - }else{ |
|
| 101 | + } else { |
|
| 102 | 102 | return response()->json(["status" => "error", "error" => "We couldn't find the task that you wanted to update."], 200); |
| 103 | 103 | } |
| 104 | 104 | } else { |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | $project = $this->storage->find($project_id); |
| 118 | 118 | |
| 119 | 119 | if ($project) { |
| 120 | - if(isset($project->tasks[$task_id])){ |
|
| 120 | + if (isset($project->tasks[$task_id])) { |
|
| 121 | 121 | unset($project->tasks[$task_id]); |
| 122 | 122 | $project->tasks = array_values($project->tasks); |
| 123 | 123 | $this->storage->update($project_id, $project); |
| 124 | 124 | return response()->json(["status" => "success"], 200); |
| 125 | - }else{ |
|
| 125 | + } else { |
|
| 126 | 126 | return response()->json(["status" => "error", "error" => "We couldn't find the task that you wanted to update."], 200); |
| 127 | 127 | } |
| 128 | 128 | } else { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | ]); |
| 82 | 82 | $update = "completed"; |
| 83 | 83 | $update_key = "status"; |
| 84 | - }else{ |
|
| 84 | + } else{ |
|
| 85 | 85 | $request->validate([ |
| 86 | 86 | "content" => "required|string|filled", |
| 87 | 87 | ]); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $this->storage->update($project_id, $project); |
| 100 | 100 | return response()->json(["status" => "success"], 200); |
| 101 | - }else{ |
|
| 101 | + } else{ |
|
| 102 | 102 | return response()->json(["status" => "error", "error" => "We couldn't find the task that you wanted to update."], 200); |
| 103 | 103 | } |
| 104 | 104 | } else { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $project->tasks = array_values($project->tasks); |
| 123 | 123 | $this->storage->update($project_id, $project); |
| 124 | 124 | return response()->json(["status" => "success"], 200); |
| 125 | - }else{ |
|
| 125 | + } else{ |
|
| 126 | 126 | return response()->json(["status" => "error", "error" => "We couldn't find the task that you wanted to update."], 200); |
| 127 | 127 | } |
| 128 | 128 | } else { |
@@ -8,18 +8,18 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class TodoBarController extends Controller { |
| 10 | 10 | |
| 11 | - public function getScripts(){ |
|
| 11 | + public function getScripts() { |
|
| 12 | 12 | return "<script type='text/javascript'>" . file_get_contents($this->assets_path("todobar.js")) . "</script>"; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - public function getDrawer(){ |
|
| 15 | + public function getDrawer() { |
|
| 16 | 16 | return View::make("laravel-todobar::todobar"); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getStyles(){ |
|
| 19 | + public function getStyles() { |
|
| 20 | 20 | $dark_mode = config("todobar.dark_mode", false); |
| 21 | 21 | $file = "todobar.css"; |
| 22 | - if($dark_mode){ |
|
| 22 | + if ($dark_mode) { |
|
| 23 | 23 | $file = "todobar-dark.css"; |
| 24 | 24 | } |
| 25 | 25 | $path = $this->assets_path($file); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | return $this->getStyles() . $this->getDrawer() . $this->getScripts(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function inject(Response $response){ |
|
| 34 | + public function inject(Response $response) { |
|
| 35 | 35 | $response->setContent(str_replace("</body>", "</body>" . $this->getInjection(), $response->getContent())); |
| 36 | 36 | } |
| 37 | 37 | |