Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

Non-static method upload() should not be called statically #24

Closed
syedarifiqbal opened this issue Mar 12, 2018 · 4 comments
Closed

Non-static method upload() should not be called statically #24

syedarifiqbal opened this issue Mar 12, 2018 · 4 comments

Comments

@syedarifiqbal
Copy link

I am trying to upload using this package but getting this error.

**Non-static method Matriphe\Imageupload\Imageupload::upload() should not be called statically**

i check the core class Imageupload and i didn't find any static method while in the documentation every example used as static method.

Note: I am using laravel 5.6

@matriphe
Copy link
Owner

Hello there.

Have you load the facade from the source? Please make sure you've added this line in the config/app.php:

Imageupload' => Matriphe\Imageupload\ImageuploadFacade::class,

In the source, you should use the facade instead of the library.

use Imageupload;
...
Imageupload::upload();

@syedarifiqbal
Copy link
Author

But i notice in document there is instruction to no need to add facade for 5.5. and i am in 5.6. do i still need this to add in config/app.php

@matriphe
Copy link
Owner

In Laravel 5.5 or above, yes you don't need to add anything in the config/app.php, the package will auto register the service provider and the facade, but you still should load the facade manually in the source.

use Imageupload;

Instead of

use Matriphe\Imageupload\Imageupload

If you don't want to use facade, just create the object, and use the regular method.

use Matriphe\Imageupload\Imageupload;

$imageupload = new Imageupload;
$imageupload->upload()

@syedarifiqbal
Copy link
Author

Okay it works. Thank you.

the problem was that i use

use Matriphe\Imageupload\Imageupload

i replace with

use Matriphe\Imageupload\Imageupload

and All good to go.

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

No branches or pull requests

2 participants