Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

Why use static at all? is there any need, ask yourself. Are you just doing this so the syntax looks pretty?

In my opinion, facades are bad news. Try not to use them as much as possible.

To address the actual question:

I would create a category service provider of some type.

0

To be honest I was just doing it like that because it worked. It seemed tidy to have it organised like that :)

I'll have a look at service providers though - thanks!

0

So what I've gone for in my workbench package is the following for the controller:

class TestController extends BaseController {
	
	protected $layout = 'workbench::layouts.common';
	protected $test;

	public function __construct(Test $test)
	{
		$this->test = $test;
	}

	public function getIndex()
	{
		$model_response = $this->test->testMe();
		Helpers::printArray($model_response);

		$this->layout->content = View::make('workbench-test::test.default');
	}
}

I know this isn't a service provider but it seems to work quite well. I assume this is a reasonable way to do it?

Thanks again

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.