0

when I tried to visit "Payout Settings" Navigation from my Instructor Panel. Then page shows 500 error. I tried to check why this happened. Then I found this "[previous exception] [object] (ErrorException(code: 0): Illegal string offset 'paytm_enable' at/home/ilanitrc/ilannoor.in/storage/framework/views/313714cd5aacd753115371d69242e5d524fa9876.php:27) [stacktrace]" error. Why this happened?

Route

Route::get('add/settings', 'InstructorSettingController@instructor')->name('instructor.pay');

Controller

public function instructor()
    {
        $user = User::where('id', Auth::User()->id)->first();
        
        return view('instructor.settings.pay_settings', compact('user'));
    }

View

<div class="row">
                      <div class="col-md-6">
                        <label for="type">{{ __('adminstaticword.Type') }}:<sup class="redstar">*</sup></label>
                            <select name="type" id="paytype" class="form-control js-example-basic-single" required >
                              <option value="none" selected disabled hidden >{{ __('adminstaticword.ChoosePaymentType') }}</option>
                              
                              @if($isetting['paytm_enable'] == 1)
                                <option {{ $user->prefer_pay_method == 'paytm' ? 'selected' : ''}} value="paytm">{{ __('adminstaticword.Paytm') }}</option>
                              @endif
                              @if($isetting['paypal_enable'] == 1)
                              <option {{ $user->prefer_pay_method == 'paypal' ? 'selected' : ''}} value="paypal">{{ __('adminstaticword.Paypal') }}</option>
                              @endif
                              @if($isetting['bank_enable'] == 1)
                              <option {{ $user->prefer_pay_method == 'banktransfer' ? 'selected' : ''}} value="bank">{{ __('adminstaticword.BankTransfer') }}</option>
                              @endif
                            </select>
                        </div>
                    </div>
imonDev
  • 13
  • 1
  • 5
  • Does this answer your question? [Illegal string offset Warning PHP](https://stackoverflow.com/questions/9869150/illegal-string-offset-warning-php) – showdev Jun 14 '21 at 19:36

1 Answers1

1

That probably means that the variable $isetting in your view is of type string, and you tried to read it as an array (you probably expect it to be an array).

You should anaylze your application, and find out what might set $isetting to be a string. Perhaps somewhere you're missing JSON-array deserialization?

Danon
  • 2,771
  • 27
  • 37