Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error at watchtower/user #12

Open
hassanharoon opened this issue Sep 14, 2016 · 8 comments
Open

error at watchtower/user #12

hassanharoon opened this issue Sep 14, 2016 · 8 comments

Comments

@hassanharoon
Copy link

hassanharoon commented Sep 14, 2016

FatalErrorException in E:\wamp\www\monkey\vendor\smarch\watchtower\src\Controllers\UserController.php line 52:
syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)

image

image

Anyone else facing the same issue ?

@landjea
Copy link
Contributor

landjea commented Sep 14, 2016

I'm not getting that error. In your config file, did you specify a model or are you using the default?

@hassanharoon
Copy link
Author

Using the default :/

@landjea
Copy link
Contributor

landjea commented Sep 15, 2016

I haven't been able to reproduce this error on a Windows box. What version of Windows/Laravel are you using? (looks like Win 7...?) Can you post your watchtower config menu? Is there anything in the laravel.log file? Oh - and which version of the package are you using?

@tzevgit
Copy link

tzevgit commented Sep 18, 2016

I just installed it view composer and I have the same error. I'm using Laravel 5.2 and PHP Version 5.6.23

I replaced at userController the "$this->model" with "User". Seems to work.

@landjea
Copy link
Contributor

landjea commented Sep 18, 2016

Okay. I just installed it again with L5.2 and can't replicate the issue. I made no changes except for the ones necessary so I don't know what to tell you guys.

Changing it to User would work, but then you are locked into using that User model. Which means you have to edit my vendor version if you want to see your changes reflected OR you have to copy over the "roles()" function from my User model.

The getModel function that incorporates the "this->model" allows you to use your own User model without having to edit mine.

On line 38-39 of your watchtower config file do you have the following lines?

'user' => [
    'model' => \Smarch\Powercores\User::class,

And is there any error logged in your laravel.log file? That would be much helpful in trying to solve this problem.

@landjea
Copy link
Contributor

landjea commented Sep 19, 2016

Found the issue. Its the PHP Version. I will sort out a fix for this asap.

@perezale
Copy link

perezale commented Dec 19, 2016

it seems that $this->getModel() is not a reference of the User class, but an instance of it .

A workaround is to replace all $this->model::method() invocation with $this->model->method().

Just take care of not replacing working static calls like Shinobi::can(...) where class_name is actually a reference to a class, not an object.

This worked for my for the @dev branch & PHP/5.6.24!

@josevillasmil
Copy link

In a Laravel 5.3 upgraded from 5.2 and PHP 5.6.4
Worked
$this->model->method() Ex. $this->model->where(

$users = $this->model->where('name', 'LIKE', '%'.$value.'%')->orderBy('name')->paginate( config('watchtower.pagination.users', 15) );

and work too;
$users = User::where('name', 'LIKE', '%'.$value.'%')->orderBy('name')->paginate( config('watchtower.pagination.users', 15) );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants