我有一个 Laravel 4 db:seed 文件,我试图在 mediatemple 网格服务器上使用它。我能够使用工匠精细(php artisan migrate)运行迁移并制作表格,但我无法为表格播种。此数据库播种在本地主机上运行良好。直到现在,我才在实时服务器上遇到任何问题。这是种子文件:
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);
}
}
它吐出这个错误:
{"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
它抱怨启动数组的行:
$Artists = [
我不知道为什么会这样。一点帮助将不胜感激。谢谢!