title: Laravel undefined variable Controller
body: <p>I have had problems with my BusinessController for a long time now. It is impossible to understand what is not written so. Please help me fix mistakes; I feel I made a lot of them)</p>
  <p>My Problem:</p>
  <p>my database business_table.php</p>
  <pre class="lang-php prettyprint-override"><code>class BusinessTable extends Migration
  {
      public function up()
      {
          Schema::create('businesses', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('name');
              $table-&gt;string('mail');
              $table-&gt;string('web-site');
              $table-&gt;timestamps();
          });
      }
      
      public function down()
      {
          Schema::drop('business');
      }
  }
  </code></pre>
  <p>My Controller: BusinessController.php</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
      namespace App\Http\Controllers;
      use \App\Models\Business;
      use Illuminate\Http\Request;
  
      class BusinessController extends Controller
      {
      public function index()
      {
      $business = \App\Models\Business::all();
      return view('business', compact('business'));
      }
      public function createbusiness()
      {
      return view('/createbusiness');
      }
      public function store()
      {
      return view('/business');
      }
      public function create()
      {
      return view('business.create');
      }
      public  function store()
      {
      $business = new Business();
      $business-&gt;title = request()-&gt;input('title');
      $business-&gt;description = request()-&gt;input('description');
      $business-&gt;save();
      return redirect('/business');
  
      }
      }
  </code></pre>
  <p>My Model: Business.php</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Factories\HasFactory;
  use Illuminate\Database\Eloquent\Model;
  
  class Business extends Model
  {
  /**
  * The table associated with the model.
  *
  * @var string
  */
  protected $table = 'business';
  }
  </code></pre>
  <p>My view file: business.blade.php</p>
  <pre class="lang-php prettyprint-override"><code>@extends('layouts.layout')
  @section('title')Бізнес@endsection
  @section ('main_content')
      &lt;h1&gt;Бизнес&lt;/h1&gt;
      &lt;p&gt;
      @foreach ($business as $singleBusiness)
          &lt;li&gt;{{ $singleBusiness-&gt;title}}&lt;/li&gt;&gt;
          @endforeach
          &lt;/p&gt;
  @endsection
  </code></pre>
  <p>my createbusiness.blade.php:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;p&gt;It works&lt;/p&gt;
  &lt;form method=&quot;post&quot; action=&quot;/business&quot;&gt;
      {{ csrf_field() }}
      &lt;div&gt;
          &lt;input type=&quot;text&quot; name=&quot;title&quot; value=&quot;&quot; placeholder=&quot;title&quot;&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;textarea type=&quot;text&quot; name=&quot;description&quot; value=&quot;&quot; placeholder=&quot;description&quot;&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;button type=&quot;sumbit&quot;&gt;Sumbit&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <p>My web.php</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
      use App\Http\Controllers\UserController;
      use Illuminate\Support\Facades\Route;
  
      /*
      |--------------------------------------------------------------------------
      | Web Routes
      |--------------------------------------------------------------------------
      |
      | Here is where you can register web routes for your application. These
      | routes are loaded by the RouteServiceProvider within a group, which
      | contains the &quot;web&quot; middleware group. Now create something great!
      |
      */
  
      Route::get('/welcome', 'App\Http\Controllers\MainController@welcome');
      Route::get('/users', 'App\Http\Controllers\MainController@users');
      Route::get('/business', 'App\Http\Controllers\BusinessController@index');
      Route::post('/business', 'App\Http\Controllers\BusinessController@store');
      Route::get('/projects', 'App\Http\Controllers\ProjectsController@index');
      Route::post('/projects', 'App\Http\Controllers\ProjectsController@store');
      Route::get('/projects/create', 'App\Http\Controllers\ProjectsController@create');
      Route::get('/business/create', 'App\Http\Controllers\BusinessController@createbusiness');
      Auth::routes();
  
      Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])-&gt;name('home');
  </code></pre>
  <p>my MainController.php:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  class MainController extends Controller
  {
      public function welcome()
      {
      return view('/welcome');
      }
      public function users()
      {
      return view('users');
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/2R7Jb.png" rel="nofollow noreferrer">my problem image</a></p>