Merge branch 'dev' of ssh://git.congegni.net:4022/Congegni/sintonia_webapp into dev
This commit is contained in:
commit
36d3deab44
26 changed files with 521 additions and 243 deletions
|
@ -42,16 +42,17 @@ class ShowController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$showInfos = $request->show;
|
||||
$showDaysRules = $request->showDaysRules;
|
||||
$showDjs = $request->showDjs;
|
||||
$show = Show::firstOrCreate($showInfos);
|
||||
$this->manageShowDays($show, $showDaysRules);
|
||||
$this->manageShowDjs($showDjs, $show);
|
||||
}catch(Exception $e){
|
||||
$showData = $request->all();
|
||||
$showDays = $showData['show_days'];
|
||||
$showDJs = $showData['show_djs'];
|
||||
$this->createShow($showData, $showDays, $showDJs);
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Show saved successfully!'
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
return response()->json(['message' => 'Show created successfully']);
|
||||
}
|
||||
|
||||
public function show(ShowResource $show)
|
||||
|
|
49
app/Http/Controllers/Show/ShowDaysController.php
Normal file
49
app/Http/Controllers/Show/ShowDaysController.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Show;
|
||||
|
||||
use App\Filters\Show\ShowFilters;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ShowDaysRequest;
|
||||
use App\Http\Resources\ShowDaysResource;
|
||||
use App\Models\Show\Show;
|
||||
use App\Models\Show\ShowDays;
|
||||
use App\Traits\Show\ShowDaysTrait;
|
||||
use Illuminate\Http\ReqshowDaysFlatest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ShowDaysController extends Controller
|
||||
{
|
||||
use ShowDaysTrait;
|
||||
public function index(Request $request)
|
||||
{
|
||||
$queryParams = collect($request->except('flattenShowDays'));
|
||||
$showDays = (new ShowDays())->searchFilter($queryParams)->get();
|
||||
if($request->flattenShowDays) $showDays = $this->showDaysFlat($showDays);
|
||||
return response()->json($showDays);
|
||||
}
|
||||
|
||||
public function store(ShowDaysRequest $request)
|
||||
{
|
||||
return new ShowDaysResource(ShowDays::create($request->validated()));
|
||||
}
|
||||
|
||||
public function show(ShowDays $ShowDays)
|
||||
{
|
||||
return new ShowDaysResource($ShowDays);
|
||||
}
|
||||
|
||||
public function update(ShowDaysRequest $request, ShowDays $ShowDays)
|
||||
{
|
||||
$ShowDays->update($request->validated());
|
||||
|
||||
return new ShowDaysResource($ShowDays);
|
||||
}
|
||||
|
||||
public function destroy(ShowDays $ShowDays)
|
||||
{
|
||||
$ShowDays->delete();
|
||||
|
||||
return response()->json();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue