I am studying Laravel 5.4
and I have the following problem:
When performing a migration, in the console of Windows
I execute the command:
php artisan migrate
When executing this command, it shows me the following error:
[Symfony \ Component \ Debug \ Exception \ FatalErrorException] Class 'Market \ Providers \ Schema' not found
How can I solve Class Schema not found
? annex the migration code:
-To create the product table:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('products', function (Blueprint $table){
$table->increments('id');
$table->string('name',100);
$table->decimal('price',5,2);
$table->integer('marks_id')->unsigned();
$table->foreign('marks_id')->references('id')->on('marks');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('products');
}
}
-To create the Brand Table
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMarkTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('marks', function (Blueprint $table){
$table->increments('id');
$table->string('name',50);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('marks');
}
}
-Code of AppServiceProvider.php
<?php
namespace Market\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}