codestudiohq / laravel-totem

Manage Your Laravel Schedule From A Web Dashboard
MIT License
1.79k stars 224 forks source link

Syntax errors #41

Closed qschmick closed 7 years ago

qschmick commented 7 years ago

While attempting to add the package to my project I received these issues. unexpected '->' (T_OBJECT_OPERATOR) AND syntax error, unexpected '('.

Steps taken:

vagrant@vagrant-ubuntu-trusty-64:/code/$ php artisan migrate
PHP Parse error:  syntax error, unexpected '->' (T_OBJECT_OPERATOR) in code/vendor/studio/laravel-totem/src/Console/Commands/ListSchedule.php on line 86

[Symfony\Component\Debug\Exception\FatalErrorException]
syntax error, unexpected '->' (T_OBJECT_OPERATOR)

Line causing error: return (CronExpression::factory($event->expression)->getNextRunDate($date->toDateTimeString()))->format('Y-m-d H:i:s'); Specifically it is the -> going to the format() function.

Commenting out this line allows for the migration to run and for the assets to be published. After adding the Totem::auth() to AppServiceProvider a new error arises from tinker or when viewing a route.

vagrant@vagrant-ubuntu-trusty-64:/code/$ php artisan schedule:list
PHP Parse error:  syntax error, unexpected '(' in /code/vendor/studio/laravel-totem/src/Totem.php on line 26                                                           

[Symfony\Component\Debug\Exception\FatalErrorException]  
syntax error, unexpected '('

Line causing error:

return (static::$authUsing ?: function () {
    return app()->environment('local');
})($request);

Removing ($request) also removes the error.

Environmental setup:

roshangautam commented 7 years ago

Looks like a php version issue. I haven't tested this in Laravel 5.4 with php 5.6. I will run some tests and will let you know.

Also, make sure you have v1.X for L5.4. If you still have pre release version installed, make sure that you run a composer update --no-scripts to bring totem to its latest version.

qschmick commented 7 years ago

Thanks for looking into it. I did test with both v1.0.0 and v1.0.1

roshangautam commented 7 years ago

Sorry for the delay. I got swamped. Can you please try updating to 1.0.2 and give this a second try ?

qschmick commented 7 years ago

Looks great. Thanks for the help. 👍