mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
April 9 update
This commit is contained in:
@@ -11,49 +11,21 @@ class ScheduleController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('admin.configs.schedule',['configs' => \App\Config::all()]);
|
||||
return view('admin.configs.schedule',['configs' => \App\Config::all(),'events_type' => \App\EventType::all()]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
public function update(Request $request)
|
||||
{
|
||||
$configs = ['admin_periode_nb'];
|
||||
$instruction_year_begin = \App\Config::find('instruction_year_begin');
|
||||
$instruction_year_end = \App\Config::find('instruction_year_end');
|
||||
|
||||
foreach ($configs as $config) {
|
||||
$c = \App\Config::all()->where('name',$config)->first();
|
||||
$c->data = [request($config)];
|
||||
$c->save();
|
||||
}
|
||||
$instruction_year_begin->data = [date('Y-m-d',strtotime($request->instruction_year_begin))];
|
||||
$instruction_year_end->data = [date('Y-m-d',strtotime($request->instruction_year_end))];
|
||||
|
||||
$new_admin_periode_begin = [];
|
||||
$new_admin_periode_end = [];
|
||||
for ($i=1; $i <= request('admin_periode_nb'); $i++) {
|
||||
if(request('admin_periode_begin_'.$i))
|
||||
{
|
||||
$new_admin_periode_begin[$i] = request('admin_periode_begin_'.$i);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_admin_periode_begin[$i] = "00:00";
|
||||
}
|
||||
if(request('admin_periode_end_'.$i))
|
||||
{
|
||||
$new_admin_periode_end[$i] = request('admin_periode_end_'.$i);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_admin_periode_end[$i] = "00:00";
|
||||
}
|
||||
}
|
||||
$instruction_year_begin->save();
|
||||
$instruction_year_end->save();
|
||||
|
||||
$temp = \App\Config::all()->where('name','admin_periode_begin')->first();
|
||||
$temp->data = $new_admin_periode_begin;
|
||||
$temp->save();
|
||||
|
||||
$temp = \App\Config::all()->where('name','admin_periode_end')->first();
|
||||
$temp->data = $new_admin_periode_end;
|
||||
$temp->save();
|
||||
|
||||
return redirect('/admin/config/schedule')->with('success','Modification sauvegarder avec succès !');
|
||||
return redirect('/admin/config/instruction')->with('success','Modification sauvegarder avec succès !');
|
||||
}
|
||||
|
||||
public function apiIndex()
|
||||
|
||||
Reference in New Issue
Block a user