title: After registration when I go to the main page I get an error - "Trying to get property 'blog_name' of non-object"
body: <p>after registering on my site, I get an error that says</p>
  <blockquote>
  <p>Trying to get property 'blog_name' of non-object</p>
  </blockquote>
  <p>How do I fix this?</p>
  <p>Here is the code in <strong>app\Http\Controllers\siteUIcontroller.php</strong></p>
  <pre><code>public function index()
  {
      return view('index')-&gt;with('blog_name' , Setting::first()-&gt;blog_name)
                          -&gt;with('categories' , Category::take(5)-&gt;get() ) 
                          -&gt;with('tags' , Tag::take(12)-&gt;get() ) 
                          -&gt;with('first_post' , Post::orderBy('created_at','desc')-&gt;first())
                          -&gt;with('second_post' , Post::orderBy('created_at','desc')-&gt;skip(1)-&gt;take(1)-&gt;get()-&gt;first())
                          -&gt;with('third_post' , Post::orderBy('created_at','desc')-&gt;skip(2)-&gt;take(1)-&gt;get()-&gt;first()) 
                          -&gt;with('fourth_post' , Post::orderBy('created_at','desc')-&gt;skip(3)-&gt;take(1)-&gt;get()-&gt;first())
                          -&gt;with('ruby_on_rails',  Category::find(2) )
                          -&gt;with('laravel',  Category::find(1) )
                          -&gt;with('settings',  Setting::first() )
                          -&gt;with('django_python',  Category::find(4) ) 
                           ;
  
  }
  </code></pre>
  <p>Can you help me?</p>