1

i developing a laravel 5 package and now i want to use: interface Gate, on laravel.

in order to use interfaces, i should do by this way:

     public function boot(GateContract $gate)
      {
...code...

$gate->define($permission->name)

    ...Codes...
       }

but i want to know is there another way use GateContract $gate without using argument of function or with using extend from class.

i mean, can i use like this way:

$gate = new Gate;

or any thing else,

1 Answer 1

1

Try something like that

$gate = $this->app->make('Gate');

There is more information about the Laravel Service container which instantiates objects over here https://laravel.com/docs/5.2/container

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.