类“App\Http\Controllers\Survey”未找到
再会。我的团队目前正在使用 Laravel 进行最终项目。我遇到了这个问题。
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use app\database\seeders\Survey;
class SurveySeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$survey = Survey::create(['name' => 'Register Form', 'settings' => ['accept-guest-entries' => true]]);
$survey->questions()->create([
'content' => 'First Name',
]);
$survey->questions()->create([
'content' => 'Last Name',
]);
$survey->questions()->create([
'content' => 'Date of Birth (MM/DD/YYYY)',
]);
$survey->questions()->create([
'content' => 'Full Address',
]);
$survey->questions()->create([
'content' => 'Blood Group',
'type' => 'radio',
'options' => ['A', 'B', 'O', 'AB']
]);
$survey->questions()->create([
'content' => 'Phone Number',
'type' => 'number',
'rules' => ['numeric', 'min:11', 'max:11']
]);
}
}
我找到了一些解决方案,但它对我不起作用。我希望你能帮助我度过这个难关。
Good day. My group our currently working in our final project using Laravel. I have this problem that I encounter.
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use app\database\seeders\Survey;
class SurveySeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$survey = Survey::create(['name' => 'Register Form', 'settings' => ['accept-guest-entries' => true]]);
$survey->questions()->create([
'content' => 'First Name',
]);
$survey->questions()->create([
'content' => 'Last Name',
]);
$survey->questions()->create([
'content' => 'Date of Birth (MM/DD/YYYY)',
]);
$survey->questions()->create([
'content' => 'Full Address',
]);
$survey->questions()->create([
'content' => 'Blood Group',
'type' => 'radio',
'options' => ['A', 'B', 'O', 'AB']
]);
$survey->questions()->create([
'content' => 'Phone Number',
'type' => 'number',
'rules' => ['numeric', 'min:11', 'max:11']
]);
}
}
I found some solutions but it doesn't work for me. I hope you can help me to get through this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的模型 Survey.php 在哪里?
如果在应用程序/模型中那么你需要
Where is your model Survey.php?
If in app/Models then you need to