After creating a model, one of them usually has this problem:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Call to undefined method MemberStatus :: all ()
The table in the database exists and was created by migrate:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MemberStatus extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('member_status', function(Blueprint $table)
{
$table->increments('id');
$table->integer('id_member_status');
$table->string('member_status',100);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('member_status');
}
}
And the seeder:
class MaritalStatusSeeder extends Seeder{
public function run(){
DB::table('marital_status')->delete();
$marital = array(
array(
'id_marital_status' => 1,
'marital_status' => 'Solteiro',
'created_at' => new DateTime,
'updated_at' => '',
),
array(
'id_marital_status' => 2,
'marital_status' => 'Casado',
'created_at' => new DateTime,
'updated_at' => '',
),
array(
'id_marital_status' => 3,
'marital_status' => 'Separado',
'created_at' => new DateTime,
'updated_at' => '',
),
array(
'id_marital_status' => 4,
'marital_status' => 'Divorciado',
'created_at' => new DateTime,
'updated_at' => '',
),
array(
'id_marital_status' => 5,
'marital_status' => 'Viuvo(a)',
'created_at' => new DateTime,
'updated_at' => '',
),
);
DB::table('marital_status')->insert($marital);
}
}
The model was then created:
class MemberStatus extends Eloquent{
protected $table = 'member_status';
public $timestamps = true;
protected $fillable = array(
'id_member_status',
'member_status',
);
}
When calling in the application a test: var_dump (MemberStatus :: all ());
Give this error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Call to undefined method MemberStatus :: all ()
It has happened in another model, what I did was create the table again. Dai worked, now not even with that.
Does anyone know what problem this is?