app/Http/Controllers/Admin/SettingController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(StoreSettingRequest $request)
    {
        abort_unless(Gate::allows('setting_create') || Auth::user()->is_superadmin, 403);
        try {
            $setting = Setting::create($request->all());
            $details = $this->prepareDetailsNew($setting);
            Activity::storeActivity('Cadastrou um novo parâmetro do sistema.', $details);
            $this->updateSession();
            alert()->success('Parâmetro criado com sucesso!')->toToast('top-end');
        } catch (\Throwable $th) {
            alert()->error('Ocorreu um erro. Este registro não foi criado.')->toToast('top-end');
        }
        return redirect()->route('admin.settings.index');
    }
public function store ( StoreSettingRequest $ request ) { abort_unless ( Gate :: allows ( 'setting_create' ) || Auth :: user ( ) -> is_superadmin , 403 ) ; try { $ setting = Setting :: create ( $ request -> all ( ) ) ; $ details = $ this -> prepareDetailsNew ( $ setting ) ; Activity :: storeActivity ( 'Cadastrou um novo parâmetro do sistema.', d etails) ; $ this -> updateSession ( ) ; alert ( ) -> success ( 'Parâmetro criado com sucesso!') - >t oToast( ' top-end') ; } catch ( \ Throwable $ th ) { alert ( ) -> error ( 'Ocorreu um erro. Este registro não foi criado.') - >t oToast( ' top-end') ; } return redirect ( ) -> route ( 'admin.settings.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .