类“App\Http\Controllers\Survey”未找到

发布于 2025-01-13 03:43:26 字数 1196 浏览 0 评论 0原文

再会。我的团队目前正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赏烟花じ飞满天 2025-01-20 03:43:26

你的模型 Survey.php 在哪里?

如果在应用程序/模型中那么你需要

use App\Models\Survey;

Where is your model Survey.php?

If in app/Models then you need to

use App\Models\Survey;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文