nhayder
262
4
Laravel

Can't access seeder file after moving file storage

Posted 3 months ago by nhayder

i'm a seeder file \Database\Seeds\TestSeeder.php and i'm running the file from controller like this

<?php

namespace App\Http\Controllers;

use Illuminate\Database\Seeder;
use Illuminate\Http\Request;
use App\Widget;
use cache;

use Illuminate\Support\Facades\DB;

class WidgetController extends Controller
{

    public function store(Request $request)
    {
        $seeder = new \Database\Seeds\Widgets\Static\TestSeeder();

        $seeder->run();
        
    }

I started getting this error after moving the file to \Database\Seeds\Widgets\Static\TestSeeder.php

{message: "syntax error, unexpected 'Static' (T_STATIC), expecting identifier (T_STRING)",…}

this is my seeder file

<?php
namespace Database\Seeds;

use Illuminate\Database\Seeder;

class TestSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        \DB::table('widgets')->insert([
            [
                'name' => 'intro-jumbotron',
                'user_name' => '',

                'dynamicbtn' => '0',
                'dynamicbtnurl' => 'javascript:void(0)',
                'cellmanagement' => '0',
                'fullscreendisabled' => '1',
                'showbuttonsdisabled' => '1',
                'showarrowdisabled' => '1',

                'page_id' => '1',
                'sorting' => '1',
           
                'fullscreen' => '0',
                'narrow' => '1',
                'pt' => 'pt-10',
                'pb' => 'pb-10',
                'mt' => '0',
                'mb' => '0',
                'mr' => '0',
        // ->list continues

any ideas

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.