This repository has been archived by the owner on Jul 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from RedRoundRobin/feature/backendMod
Feature/backend mod
- Loading branch information
Showing
11 changed files
with
367 additions
and
175 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,62 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Providers\ViewGraphServiceProvider; | ||
use App\Providers\ViewServiceProvider; | ||
|
||
class GraphsController extends Controller | ||
{ | ||
private $viewGraphProvider; | ||
private $viewProvider; | ||
|
||
|
||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->middleware('auth'); | ||
$this->viewGraphProvider = new ViewGraphServiceProvider(); | ||
$this->viewProvider = new ViewServiceProvider(); | ||
} | ||
public function store($viewId) | ||
{ | ||
if ($this->viewProvider->find($viewId)) { | ||
$data = request()->validate([ | ||
'correlation' => 'required|string|in:0,1,2,3', | ||
'sensor1' => 'required|string', | ||
'sensor2' => 'required|string' | ||
]); | ||
$data['view'] = $viewId; | ||
$data = array_map(function ($value) { | ||
return (int)$value; | ||
}, $data); | ||
$this->viewGraphProvider->store(json_encode($data)); | ||
return redirect(route('views.show', ['viewId' => $viewId])); | ||
} | ||
} | ||
public function destroy($viewGraphId) | ||
{ | ||
$this->viewGraphProvider->destroy($viewGraphId); | ||
return redirect(route('views.index')); | ||
} | ||
|
||
/* public function update($viewId){ | ||
if($this->viewProvider->find($viewId)){ | ||
$data = request()->validate([ | ||
'correlation' => 'required|string|in:0,1,2,3', | ||
'sensor1' => 'required|string', | ||
'sensor2' => 'required|string' | ||
]); | ||
$data['view'] = $viewId; | ||
$data = array_map(function ($value) { | ||
return (int)$value; | ||
}, $data); | ||
$this->viewGraphProvider->update($viewId, json_encode($data)); | ||
return redirect(route('views.show', ['viewId' => $viewId])); | ||
} | ||
}*/ | ||
} |
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
Oops, something went wrong.