Professor Vinícios estou com esse erros gostaria de uma ajuda. Illuminate \ Database \ QueryException (HY000) SQLSTATE[HY000]: General error: 1 table temporadas has no column named serie_id (SQL: insert into "temporadas" ("numero", "serie_id") values (1, 20))
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Http\Requests\ResquestForm;
use App\Serie;
use App\Temporadas;
use http\Header;
use Illuminate\Http\Request;
use phpDocumentor\Reflection\Location;
class SeriesController extends Controller
{
public function index(Request $request){
// echo $request->url();
// var_dump($request->query('teste')) ;
$series = serie::query()->orderby('nome')->get();
$mensagem = $request->session()->get( 'mensagem');
$delete = $request->session()->get('delete');
// $series = serie::all();
//var_dump($series);
//exit();
//comonado compact verifica na view uma variavel com valor informado
return view('series.index',compact('series', 'mensagem','delete'));
}
public function create(){
return view('series.create');
}
public function store(ResquestForm $request)
{
$serie = Serie::create(['nome' => $request->nome]);
$qtdTemporadas = $request->qtd_temporadas;
for ($i = 1; $i <= $qtdTemporadas; $i++) {
$temporada = $serie->temporadas()->create(['numero' => $i]);
for ($j = 1; $j <= $request->ep_por_temporada; $j++) {
$temporada->episodios()->create(['numero' => $j]);
}
}
$request->session()->flash(
'mensagem',
"Série {$serie->id} e suas temporadas e epsodios criadas com sucesso {$serie->nome}"
);
// $request->session()->flash('menssagem',"add com sucesso {$serie->nome}");
return redirect('/series');
}
public function destroy(Request $request){
Serie::destroy($request->id);
$request->session()->flash('delete',"Serie {$request->id} deletada com sucesso");
return redirect()->route('listar_series');
}
}
?>
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CriarTabelaSeries extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('series',function (Blueprint $table){
$table->bigIncrements('id');
$table->string('nome');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('series');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTemporadasTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('temporadas', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('numero');
$table->integer('id_serie');
$table->foreign('id_serie')->references('id')->on('series');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('temporadas');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEpsodiosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('epsodios', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('numero');
$table->integer('id_temporadas');
$table->foreign('id_temporadas')->references('id')->on('temporadas');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('epsodios');
}
}