public function store()
    {
        $input      = Input::all();
        $user       = auth()->user();
        $attributes = [
            'user_id' => $user->hasRoles('member') ? $user->id : array_get($input, 'user'),
            'name'    => array_get($input, 'name'),
            'value'   => array_only($input, ['field_1', 'field_2'])
        ];

        $model = new ModuleRow($attributes);
        $form  = $this->form($model);
        if (!$form->isValid()) {
            return redirect_with_errors(handles('antares::sample_module/index/create'), $form->getMessageBag());
        }
        if (!$model->save()) {
            event('notifications.item_has_not_been_created', ['variables' => ['user' => $user, 'item' => $model]]);
            return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.save_error'), 'error');
        }
        event('notifications.item_has_been_created', ['variables' => ['user' => $user, 'item' => $model]]);
        return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.save_success'), 'success');
    }
public function store()
    {
        $input      = Input::all();
        $user       = auth()->user();
        $attributes = [
            'user_id' => $user->hasRoles('member') ? $user->id : array_get($input, 'user'),
            'name'    => array_get($input, 'name'),
            'value'   => array_only($input, ['field_1', 'field_2'])
        ];

        $model = new ModuleRow($attributes);
        $form  = $this->form($model);
        if (!$form->isValid()) {
            return redirect_with_errors(handles('antares::sample_module/index/create'), $form->getMessageBag());
        }
        if (!$model->save()) {
            event('notifications.item_has_not_been_created', ['variables' => ['user' => $user, 'item' => $model]]);
            return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.save_error'), 'error');
        }
        event('notifications.item_has_been_created', ['variables' => ['user' => $user, 'item' => $model]]);
        return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.save_success'), 'success');
    }
public function store ( ) { $ input = Input :: all ( ) ; $ user = auth ( ) -> user ( ) ; $ attributes = [ 'user_id' => $ user -> hasRoles ( 'member' ) ? $ user -> id : array_get ( $ input , 'user' ) , 'name' => array_get ( $ input , 'name' ) , 'value' => array_only ( $ input , [ 'field_1' , 'field_2' ] ) ] ; $ model = new ModuleRow ( $ attributes ) ; $ form = $ this -> form ( $ model ) ; if ( ! $ form -> isValid ( ) ) { return redirect_with_errors ( handles ( 'antares::sample_module/index/create' ) , $ form -> getMessageBag ( ) ) ; } if ( ! $ model -> save ( ) ) { event ( 'notifications.item_has_not_been_created' , [ 'variables' => [ 'user' => $ user , 'item' => $ model ] ] ) ; return redirect_with_message ( handles ( 'antares::sample_module/index' ) , trans ( 'antares/sample_module::messages.save_error' ) , 'error' ) ; } event ( 'notifications.item_has_been_created' , [ 'variables' => [ 'user' => $ user , 'item' => $ model ] ] ) ; return redirect_with_message ( handles ( 'antares::sample_module/index' ) , trans ( 'antares/sample_module::messages.save_success' ) , 'success' ) ; }
When stores form fields in database

@return \Illuminate\Http\RedirectResponse
When stores form fields in database