作为程序员一定要保持良好的睡眠,才能好编程

laravel thinker详细使用

发布时间:2020-01-18



开启tinker:

php artisan tinker



tinker 是一个常驻进程,修改文件后,请重新启动tinker


image.png


执行多条语句

image.png



image.png



演示tinker


image.png



操作演示


创建一个model类

image.png

G:\phpstudy\WWW\laravel_base>php artisan make:model Stu
Model created successfully.

image.png


class Stu extends Model
{
    protected $table='migrations';
    //
    public function getMigrateList(){


        return \DB::table('migrations')->get()->toArray();


    }
}


启动tinker,然后在tinker中进行运行和测试:


image.png