DB:seed file for Laravel 4 working fine on local host, not working on Mediatemple gridserver?

StackOverflow https://stackoverflow.com/questions/17586145

  •  02-06-2022
  •  | 
  •  

Вопрос

I have a Laravel 4 db:seed file that I am trying to use on mediatemple gridserver. I was able to run a migration with artisan fine (php artisan migrate), and make the tables, but I am not able to seed the tables. This database seeding worked fine on local host. It is only now on a live server that I am experiencing any issues with it. Here is the seed file:

ArtistsTableSeeder.php:

class ArtistsTableSeeder extends Seeder {

    public function run()
    {
        // Uncomment the below to wipe the table clean before populating
        // DB::table('artists')->delete();

        $artists = array(

        );

        $Artists = [
            ['stage_name' => 'Blah', 'city' => 'Blah', 'state' => 'blah', 'video_path' => 'youtube.com', 'image_path' => 'filepickerimage', 'soundcloud_profile' => 'https://soundcloud.com/', 'description' => '', 'created_at' => new DateTime, 'updated_at' => new DateTime]


        ];

        // Uncomment the below to run the seeder
        DB::table('artists')->insert($Artists);
    }

}

It is spitting out this error:

{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"syntax error, unexpected '['","file":"\/nfs\/c09\/h04\/mnt\/139243\/domains\/crowdsets.com\/html\/app\/database\/seeds\/ArtistsTableSeeder.php","linemichaelsutyak.com@n26:/home/139243/domains/crowdsets.com/html$ php artisan db:seed

It is complaining about the line that starts the array:

$Artists = [

I have no idea why this is happening. A little help would be appreciated. Thank you!

Это было полезно?

Решение

That syntax error you get is probably caused by a feature that has been added in PHP 5.4 (short array syntax), so I'd guess your hoster still runs 5.3.x. You should check the PHP version on the mediatemple grid server and update it if necessary.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top