Php 调用未定义的方法App\Profile::create()

Php 调用未定义的方法App\Profile::create(),php,laravel-5,Php,Laravel 5,这是我的迁移表 create_profile_table.php: <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateProfileTable extends Migration { /** * Run the migrations.

这是我的迁移表
create_profile_table.php

    <?php 

    use Illuminate\Database\Schema\Blueprint;
    use Illuminate\Database\Migrations\Migration;

    class CreateProfileTable extends Migration
    {
        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up()
        {
            Schema::create('profile', function (Blueprint $table) {
                $table->integer('userid')->unsigned()->default(0);
                $table->string('profilePic')->default('http://b2.com/Images/anup.jpg');
                $table->string('about',255);
                $table->foreign('userid')->references('id')->on('users')->onDelete('cascade');
                $table->timestamps();
            });
        }

        /**
         * Reverse the migrations.
         *
         * @return void
         */
        public function down()
        {
            Schema::drop('profile');
        }
    }
    use Illuminate\Database\Seeder;
    use Illuminate\Database\Eloquent\Model;
    use App\Profile;

    class ProfileSeeder extends Seeder
    {

        public function run()
        {
             Profile::create(array('userid'=>1,'about'=>'Hello World'));
             Profile::create(array('userid'=>2,'about'=>'Hello World'));
             Profile::create(array('userid'=>3,'about'=>'Hello World'));
             Profile::create(array('userid'=>4,'about'=>'Hello World'));
             Profile::create(array('userid'=>5,'about'=>'Hello World'));
        }



    }
    namespace App;


    class Profile
    {
         protected $table='profile';
         protected $fillable=['userid','about'];


    }
这是我的模型php文件model
Profile.php
    use Illuminate\Database\Seeder;
    use Illuminate\Database\Eloquent\Model;
    use App\Profile;

    class ProfileSeeder extends Seeder
    {

        public function run()
        {
             Profile::create(array('userid'=>1,'about'=>'Hello World'));
             Profile::create(array('userid'=>2,'about'=>'Hello World'));
             Profile::create(array('userid'=>3,'about'=>'Hello World'));
             Profile::create(array('userid'=>4,'about'=>'Hello World'));
             Profile::create(array('userid'=>5,'about'=>'Hello World'));
        }



    }
    namespace App;


    class Profile
    {
         protected $table='profile';
         protected $fillable=['userid','about'];


    }
显示错误:

[Symfony\Component\Debug\Exception\FatalErrorException]调用未定义的方法App\Profile::create()

我是一个新的学习者

不知道为什么会显示此错误


我们将非常感谢您在此问题上提供的任何帮助。

如果您希望能够使用有说服力的方法,如
create()
find()
等,您的
Profile
类需要扩展
Model

您应该使用
php artisan
来创建您的模型、迁移、种子机和任何其他Laravel“组件”,它们将以最小的工作量立即工作

namespace App;
use Illuminate\Database\Eloquent\Model;


class Profile extends Model
{
     protected $table='profile';
     protected $fillable=['userid','about'];

}

如果这解决了你的问题,请考虑把它标记为答案;