mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
fix Setting::get()
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\TorrentResource;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Torrent;
|
||||
use App\Repositories\TorrentRepository;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -21,7 +22,7 @@ class TorrentController extends Controller
|
||||
{
|
||||
$params = $request->all();
|
||||
$params['visible'] = Torrent::VISIBLE_YES;
|
||||
$params['category_mode'] = get_setting('main.browsecat');
|
||||
$params['category_mode'] = Setting::get('main.browsecat');
|
||||
$result = $this->repository->getList($params);
|
||||
$resource = TorrentResource::collection($result);
|
||||
$resource->additional([
|
||||
|
||||
@@ -15,9 +15,11 @@ class Setting extends NexusModel
|
||||
$rows = self::query()->get(['name', 'value']);
|
||||
foreach ($rows as $row) {
|
||||
$value = $row->value;
|
||||
$arr = json_decode($value, true);
|
||||
if (is_array($arr)) {
|
||||
$value = $arr;
|
||||
if (!is_null($value)) {
|
||||
$arr = json_decode($value, true);
|
||||
if (is_array($arr)) {
|
||||
$value = $arr;
|
||||
}
|
||||
}
|
||||
Arr::set($settings, $row->name, $value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user