|
@@ -2,25 +2,69 @@
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
+use App\Components\AsyncResponse;
|
|
|
|
|
+use App\Http\Requests\Station\StationRuleBatchRequest;
|
|
|
|
|
+use App\Services\OwnerService;
|
|
|
|
|
+use App\Station;
|
|
|
use App\StationRuleBatch;
|
|
use App\StationRuleBatch;
|
|
|
|
|
+use Illuminate\Contracts\Foundation\Application;
|
|
|
|
|
+use Illuminate\Contracts\View\Factory;
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
|
|
|
+use Illuminate\Http\Response;
|
|
|
|
|
+use Illuminate\View\View;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class StationRuleBatchController extends Controller
|
|
class StationRuleBatchController extends Controller
|
|
|
{
|
|
{
|
|
|
|
|
+ use AsyncResponse;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Display a listing of the resource.
|
|
* Display a listing of the resource.
|
|
|
*
|
|
*
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @param Request $request
|
|
|
|
|
+ * @param OwnerService $ownerService
|
|
|
|
|
+ * @return Application|Factory|View
|
|
|
*/
|
|
*/
|
|
|
- public function index()
|
|
|
|
|
|
|
+ public function index(Request $request,OwnerService $ownerService)
|
|
|
{
|
|
{
|
|
|
- //
|
|
|
|
|
|
|
+ $stationRuleBatches = StationRuleBatch::query()->with('stationType','owner')->orderByDesc('id')->paginate($request['paginate'] ?? 50);
|
|
|
|
|
+ $owners = $ownerService->getAuthorizedOwners();
|
|
|
|
|
+ return view('station.rule.index',compact('stationRuleBatches','owners'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * store API
|
|
|
|
|
+ * @param StationRuleBatchRequest $request
|
|
|
|
|
+ */
|
|
|
|
|
+ public function storeApi(StationRuleBatchRequest $request)
|
|
|
|
|
+ {
|
|
|
|
|
+ $stationRuleBatch = StationRuleBatch::query()->create($request->only(['name','owner_id']));
|
|
|
|
|
+ $stationRuleBatch->load('stationType','owner');
|
|
|
|
|
+ $this->success($stationRuleBatch);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * update API
|
|
|
|
|
+ * @param StationRuleBatchRequest $request
|
|
|
|
|
+ */
|
|
|
|
|
+ public function updateApi(StationRuleBatchRequest $request)
|
|
|
|
|
+ {
|
|
|
|
|
+ $stationRuleBatch = StationRuleBatch::query()->whereKey($request['id'])->first();
|
|
|
|
|
+ $stationRuleBatch->update($request->all());
|
|
|
|
|
+ $stationRuleBatch->load('stationType','owner');
|
|
|
|
|
+ $this->success($stationRuleBatch);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function destroyApi(Request $request)
|
|
|
|
|
+ {
|
|
|
|
|
+ StationRuleBatch::query()->whereKey($request['id'])->delete();
|
|
|
|
|
+ $this->success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Show the form for creating a new resource.
|
|
* Show the form for creating a new resource.
|
|
|
*
|
|
*
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function create()
|
|
public function create()
|
|
|
{
|
|
{
|
|
@@ -31,7 +75,7 @@ class StationRuleBatchController extends Controller
|
|
|
* Store a newly created resource in storage.
|
|
* Store a newly created resource in storage.
|
|
|
*
|
|
*
|
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Illuminate\Http\Request $request
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function store(Request $request)
|
|
public function store(Request $request)
|
|
|
{
|
|
{
|
|
@@ -42,7 +86,7 @@ class StationRuleBatchController extends Controller
|
|
|
* Display the specified resource.
|
|
* Display the specified resource.
|
|
|
*
|
|
*
|
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function show(StationRuleBatch $stationRuleBatch)
|
|
public function show(StationRuleBatch $stationRuleBatch)
|
|
|
{
|
|
{
|
|
@@ -53,7 +97,7 @@ class StationRuleBatchController extends Controller
|
|
|
* Show the form for editing the specified resource.
|
|
* Show the form for editing the specified resource.
|
|
|
*
|
|
*
|
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function edit(StationRuleBatch $stationRuleBatch)
|
|
public function edit(StationRuleBatch $stationRuleBatch)
|
|
|
{
|
|
{
|
|
@@ -65,7 +109,7 @@ class StationRuleBatchController extends Controller
|
|
|
*
|
|
*
|
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Illuminate\Http\Request $request
|
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function update(Request $request, StationRuleBatch $stationRuleBatch)
|
|
public function update(Request $request, StationRuleBatch $stationRuleBatch)
|
|
|
{
|
|
{
|
|
@@ -76,7 +120,7 @@ class StationRuleBatchController extends Controller
|
|
|
* Remove the specified resource from storage.
|
|
* Remove the specified resource from storage.
|
|
|
*
|
|
*
|
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
* @param \App\StationRuleBatch $stationRuleBatch
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function destroy(StationRuleBatch $stationRuleBatch)
|
|
public function destroy(StationRuleBatch $stationRuleBatch)
|
|
|
{
|
|
{
|