I have a problem with php artisan tinker, can't find the reason why he wants a 'businesses' table but not a 'business' table. Help me fix mistakes, I feel I did a lot of them) My Problem :
Illuminate\Database\QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.businesses' doesn't exist (SQL: select * from `businesses`)'
my database business_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class BusinessTable extends Migration
{
/**
* Выполнение миграций.
*
* @return void
*/
public function up()
{
Schema::create('business', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('mail');
$table->string('web-site');
$table->timestamps();
});
}
/**
* Отмена миграций.
*
* @return void
*/
public function down()
{
Schema::drop('business');
}
}
My Controller: BusinessController.php
<?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.index', compact('business'));
}
public function store()
{
$business = new Business();
$business->title = request()->input('title');
$business->description = request()->input('description');
$business->save();
return redirect('/business');
}
}
My Model: Business.php
<?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.index', compact('business'));
}
public function store()
{
$business = new Business();
$business->title = request()->input('title');
$business->description = request()->input('description');
$business->save();
return redirect('/business');
}
}
My view file: business.blade.php
@extends('layouts.layout')
@section('title')Бізнес@endsection
@section ('main_content')
<h1>Бизнес</h1>
<p>
<li>{{ $business->title}}</li>>
</p>
@endsection
Image my error: my error