I have a few seed files that make use of arrays that use the convention:
Array = [ ];
The array uses brackets instead of parentheses.
I have checked my php version using a phpinfo.php file, and it is reading: PHP Version 5.5.0
When I try to run php artisan db:seed in the terminal, I get the following error:
php artisan db:seed
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"syntax error, unexpected '['","file":"\/nfs\/c09\/h04\/mnt\/139243\/domains\/*********.com\/app\/database\/seeds\/ArtistsTableSeeder.php","line":14}}
This has worked fine on my localhost, so I don't know what is going wrong. Thank you for your help!
EDIT (Here is ArtistsTableSeeder.php):
<?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' => 'Bob', 'city' => 'San Francisco', 'state' => 'CA', 'video_path' => 'http://www.youtube.com', 'image_path' => 'https://www.filepicker.io', 'soundcloud_profile' => 'https://soundcloud.com', 'created_at' => new DateTime, 'updated_at' => new DateTime],
['stage_name' => 'Joe', 'city' => 'San Francisco', 'state' => 'CA', 'video_path' => 'http://www.youtube.com', 'image_path' => 'https://www.filepicker.io', 'soundcloud_profile' => 'https://soundcloud.com', 'created_at' => new DateTime, 'updated_at' => new DateTime],
['stage_name' => 'George', 'city' => 'San Francisco', 'state' => 'CA', 'video_path' => 'http://www.youtube.com', 'image_path' => 'https://www.filepicker.io', 'soundcloud_profile' => 'https://soundcloud.com', 'created_at' => new DateTime, 'updated_at' => new DateTime],
['stage_name' => 'Greg', 'city' => 'Seattle', 'state' => 'WA', 'video_path' => 'http://www.youtube.com', 'image_path' => 'https://www.filepicker.io', 'soundcloud_profile' => 'https://soundcloud.com', 'created_at' => new DateTime, 'updated_at' => new DateTime],
['stage_name' => 'Leo', 'city' => 'San Francisco', 'state' => 'CA', 'video_path' => 'http://www.youtube.com', 'image_path' => 'https://www.filepicker.io', 'soundcloud_profile' => 'https://soundcloud.com', 'created_at' => new DateTime, 'updated_at' => new DateTime],
['stage_name' => 'Nuck', 'city' => 'San Francisco', 'state' => 'CA', 'video_path' => 'http://www.youtube.com', 'image_path' => 'https://www.filepicker.io', 'soundcloud_profile' => 'https://soundcloud.com', 'created_at' => new DateTime, 'updated_at' => new DateTime]
];
// Uncomment the below to run the seeder
DB::table('artists')->insert($Artists);
}
}
ANSWER EDIT: For others having issues, in the command line I had to use php-latest artisan db:seed. This ensured I used the latest version of php.