mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Get rid of more facade usage
This commit is contained in:
parent
caf8e29852
commit
d27526431c
|
@ -15,7 +15,7 @@ class Core
|
|||
return $default;
|
||||
}
|
||||
|
||||
if (is_null($value = DB::table('config')->where('key', $key)->pluck('value'))) {
|
||||
if (is_null($value = app('db')->table('config')->where('key', $key)->pluck('value'))) {
|
||||
$value = $default;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ use Flarum\Core;
|
|||
use Flarum\Support\Actor;
|
||||
use Flarum\Support\HtmlAction;
|
||||
use Flarum\Forum\Events\RenderView;
|
||||
use Illuminate\Database\DatabaseManager;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Session;
|
||||
use DB;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
||||
class IndexAction extends HtmlAction
|
||||
{
|
||||
|
@ -15,18 +15,24 @@ class IndexAction extends HtmlAction
|
|||
|
||||
protected $actor;
|
||||
|
||||
public function __construct(Client $apiClient, Actor $actor)
|
||||
protected $session;
|
||||
|
||||
protected $database;
|
||||
|
||||
public function __construct(Client $apiClient, Actor $actor, DatabaseManager $database, SessionInterface $session)
|
||||
{
|
||||
$this->apiClient = $apiClient;
|
||||
$this->actor = $actor;
|
||||
$this->session = $session;
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
public function render(Request $request, $params = [])
|
||||
{
|
||||
$config = DB::table('config')->whereIn('key', ['base_url', 'api_url', 'forum_title', 'welcome_title', 'welcome_message'])->lists('value', 'key');
|
||||
$config = $this->database->table('config')->whereIn('key', ['base_url', 'api_url', 'forum_title', 'welcome_title', 'welcome_message'])->lists('value', 'key');
|
||||
$data = [];
|
||||
$session = [];
|
||||
$alert = Session::get('alert');
|
||||
$alert = $this->session->get('alert');
|
||||
|
||||
if (($user = $this->actor->getUser()) && $user->exists) {
|
||||
$session = [
|
||||
|
|
Loading…
Reference in New Issue
Block a user