Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SettingController
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 edit
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 update
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Http\Controllers\Dashboard;
4
5use App\Http\Controllers\Controller;
6use App\Models\Setting;
7use Illuminate\Http\Request;
8
9class SettingController extends Controller
10{
11    public function edit(){
12        $setting = Setting::first();
13
14        return view('Dashboard.settings.edit')->with('data', $setting);
15    }
16
17    public function update(Request $request){
18        $setting = Setting::first();
19
20        $setting->site_name = $request->site_name;
21        $setting->date_format = $request->date_format;
22        $setting->time_zone = $request->time_zone;
23        $setting->save();
24
25        //update sessaions
26        session(['site_name'    => $setting->site_name]);
27        session(['date_format'  => $setting->date_format]);
28        session(['time_zone'    => $setting->time_zone]);
29
30        return redirect('dashboard/settings/edit')->with('success', 'success');
31    }
32}