I want to create an shopify app with laravel.I am using the package https://packagist.org/packages/bnmetrics/laravel-shopify-api
I have followed all the steps shown there.But after running this app I am getting this error
Non-static method BNMetrics\Shopify\Shopify::make() should not be called statically
I have already registered service provider and add shopify facade as instructed.But the issue exist.Is there anything I am missing?
I am newbie to laravel and sorry for my bad English.
I know this is an old post, but I had the same problem and I realized that I was importing
use BNMetrics\Shopify\Shopify;
and I just needed to import
use Shopify;
just in case it helps someone else
Related
I need to get access to Slack's Event API from my Laravel 5.3 application. I have installed vluzrmos's package from GitHub, but I can't get it to work properly. I ran through all the steps in the installation, but when I try to do SlackUser::lists() in my Controller I get an error like this:
Non-static method Vluzrmos\SlackApi\Contracts\SlackUser::lists() cannot be called statically, assuming $this from incompatible context.
Could you help? Thanks
Assuming you have configured the providers & aliases correctly (in config/app.php), you need to add:
use SlackUser;
to the top of your class, and then call:
SlackUser::lists();
Please post your usage of SlackUser::lists(); if this doesn't solve your issue.
I start developing a project based on Sylius and after install process I want to customize Backend Dashboard. As Sylius works with services, I found that BackendMenuBuilder is a service called "sylius.menu_builder.backend". With this in mind and some googling I edited my "services.yml" in AppBundle/Resources/config" and put this lines:
services:
sylius.menu_builder.backend:
class: AppBundle\Menu\Backend\BackendMenu
I created a new class "BackendMenu" in "AppBundle\Menu\Backend" to be called instead the "default" Sylius service. I've got some error in my first tries but after I could overwrite the default service in this way. Is this the right way to do that? For any new service that I want to not use the default version should I insert this new parameter in my "services.yml"? I wonder this because I think developing a medium/big project over Sylius platform and maybe it could be a handy problem.
Instead overwriting whole service definition You can just provide Your own class paramerter. Example:
parameters:
sylius.menu_builder.backend.class: AppBundle\Menu\Backend\BackendMenu
Then You don't need to redeclare all arguments (if there are any).
Other ways it to do this with ComplierPass - http://symfony.com/doc/current/bundles/override.html#services-configuration
Have recently starting using UserFrosting to as part of a project and I'm having some problems using Facades within UserFrosting and would appreciate some help if possible.
I am attempting to use the File facade from within a UserFrosting controller to create a folder on the local filesystem using the following code
use Illuminate\Support\Facades\File;
......
$directoryCreated = File::makeDirectory($directoryPath);
However at runtime i get the following error
PHP Fatal error: Call to a member function makeDirectory() on null in /var/www/test-app/userfrosting/vendor/illuminate/support/Facades/Facade.php on line 210
It seems that the UserFrosting app does not recognise the File facade (or any other facacde - i also tried Storage) and it has not been registered with the app.
Is it possible to use the facade classes with UserFrosting?
If so do I have to register them somewhere within the UserFrosting app config?
Any direction pointers would be greatly appreciated.
Thanks in advance!
From the Facade documentation:
Laravel "facades" serve as "static proxies" to underlying classes in the service container...
So, it looks like Laravel's facades depend on Laravel's service container. You can read more about how Laravel sets up the default facades here: https://www.sitepoint.com/how-laravel-facades-work-and-how-to-use-them-elsewhere/#how-laravel-aliases-the-facades
Unfortunately, UserFrosting does not use Laravel's service container. Rather, it uses Slim, which has its own service container. In Slim v2 (which UF 0.3.1 uses), the Slim application itself is the service container.
You can define services for UF in initialize.php. So, you might try something like:
$app->filesystem = new \Illuminate\Filesystem\Filesystem();
Then later, you can use the filesystem service like:
$app->filesystem->makeDirectory($directoryPath);
You could try to use Slim's container to allow the Facade to resolve its accessor (it will use array access on the container to resolve it). You would have to make sure that the binding the facade uses exists. You can take a look at the Service Provider that corresponds to the service you want to use to know how its setting up the binding.
The File facade is accessing the binding 'files' (Illuminate\Filesystem\Filesystem).
\Illuminate\Support\Facades\Facade::setFacadeApplication($container);
\Illuminate\Support\Facades\File::makeDirectory(...);
Its worth a shot, but its mostly the binding that is being resolved that is important.
Adding Httpful (http://phphttpclient.com/) to ATK4 using the recommended Composer method does not work.
After some fooling around I managed to get all the file paths correct but I get "Fatal error: Class 'Frontend' not found in /var/www/portal/index.php on line 14".
Using the 'phar' method described on Httpful's page is also a no-go.
I don't know if this needs to be implemented through an add-on, and if it does, I don't know how. Any info/pointers would be appreciated...
The bottom line is: I need to interact with a REST API in a sane way, it doesn't have to be Httpful specifically, is there another solution out there that someone has already implemented in ATK4?
Please look into this repository which is designed to run Agile Toolkit based on composer primarily:
https://github.com/atk4/atk4-secure/
You can also look at this branch:
https://github.com/atk4/atk4/tree/4.3-PageManager-refactoring
which deals with this issue:
https://github.com/atk4/atk4/issues/403
although that's not part of the "master" branch, instead it went to 4.3. Perhaps you can back-port the commits.
Edit: I must also mention, that this should work best if you have picked Agile Toolkit from Git repository.
Hi i am trying to use Sign me up Plugin for my application. But unable to get it running. There are so many issues and errors.
Plugin i have downloaded is:-
sign_me_up-2.0
But there are so many errors i am getting
Ex:- Declaration of SignMeUpComponent::initialize() should be compatible with Component::initialize(Controller $controller)
I have tried for tutorials and serached for solutions online. But no luck...
Can anyone help me out on how to use this plugin ???
What i reffered :-
http://www.jotlab.com/2011/sign-me-up-a-cakephp-registration-plugin
Thanks in advance
Make sure your version of CakePHP is compatible with the plugin. I understand between version 1.3 and 2, they took advantage of the newer features of PHP which included strongly-typed method parameters. The error you're receiving is that the SignMeUpComponent inherits from the Component class which is in framework core. If the component wants to override the initialize method, it must follow the same method/function signature.
If the plugin is on Git and you feel comfortable in doing so, clone it and update all the components methods, and then put in a pull request so you're changes can be merged in.
Alternatively use an earlier version of CakePHP.