title: why i can not get value in laravel 5.8?
body: <p>If I use <code>{{$slider-&gt;name}}</code> it can not retrieve the data from database. But at the same time it can retrieve  data for <code>id</code>. If I use <code>{{$slider['name']}}</code> it can retrieve the name from database.</p>
  
  <p>Can someone please tell me the reason behind this problem?<br>
  controller</p>
  
  <pre><code>public function index()
  {
  
      $sliders=Slider::all();
      //($sliders);
      return view('slider.list',compact('sliders'));
  }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>@extends('master')
  
  @section('content')
  
  &lt;section class="content-header"&gt;
      &lt;h1&gt;
          Slider List
      &lt;/h1&gt;
  &lt;/section&gt;
  &lt;section class="content"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-xs-12"&gt;
              &lt;div class="box"&gt;
                  &lt;div class="box-header"&gt;
                      @if($message = Session::get('success'))
                          &lt;div class="alert alert-success alert-dismissible"&gt;{{ $message }}&lt;/div&gt;
                      @endif
                  &lt;/div&gt;
                  &lt;div class="box-body"&gt;
                      &lt;table id="pageList" class="table table-bordered table-striped table-responsive"&gt;
                          &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th&gt;SL&lt;/th&gt;
                              &lt;th&gt;Slider Name&lt;/th&gt;
                              &lt;th&gt;Image&lt;/th&gt;
                              &lt;th&gt;Published&lt;/th&gt;
                              &lt;th&gt;Created by&lt;/th&gt;
                              &lt;th&gt;Created at&lt;/th&gt;
                              &lt;th&gt;Action&lt;/th&gt;
                          &lt;/tr&gt;
                          &lt;/thead&gt;
                          &lt;tbody&gt;
                          @foreach($sliders as $slider)
                              &lt;tr&gt;
                                  &lt;td&gt;{{$slider-&gt;id}}&lt;/td&gt;
                                  &lt;td&gt;{{$slider['name']}}&lt;/td&gt;
                                  &lt;td&gt;
                                      @if($images=\App\SliderImage::where('slider_id','=',$slider-&gt;id)-&gt;get())
                                          @foreach($images as $image)
                                              &lt;img width="80px" alt="image"
                                                   src="{{ asset('images/sliderImage/'.$image['image_path']) }}"&gt;
                                          @endforeach
                                      @endif
  
                                  &lt;/td&gt;
                                  &lt;td&gt;{{$slider-&gt;published}}&lt;/td&gt;
                                  &lt;td&gt;{{$slider-&gt;created_By}}&lt;/td&gt;
                                  &lt;td&gt;{{$slider-&gt;created_at}}&lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;form action="{{route('slider.destroy',$slider-&gt;id)}}" method="POST"&gt;
                                          &lt;a href="{{route('slider.edit',$slider-&gt;id)}}"
                                             class="btn btn-sm btn-success"&gt;Edit&lt;/a&gt;
                                          &lt;a href="" class="btn btn-sm btn-info"&gt;View&lt;/a&gt;
                                          @CSRF
                                          @method('DELETE')
                                          &lt;button type="submit" class="btn btn-sm btn-danger"
                                                  onclick="return confirm('Are you sure to delete?')"&gt;Delete
                                          &lt;/button&gt;
                                      &lt;/form&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                          @endforeach
                          &lt;/tbody&gt;
                          &lt;tfoot&gt;
                          &lt;tr&gt;
                              &lt;th&gt;SL&lt;/th&gt;
                              &lt;th&gt;Slider Name&lt;/th&gt;
                              &lt;th&gt;Image&lt;/th&gt;
                              &lt;th&gt;Published&lt;/th&gt;
                              &lt;th&gt;Created by&lt;/th&gt;
                              &lt;th&gt;Created at&lt;/th&gt;
                              &lt;th&gt;Action&lt;/th&gt;
                          &lt;/tr&gt;
                          &lt;/tfoot&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/section&gt;
  
  @endsection
  </code></pre>