Merge pull request #953 from keriati/refactor/ideafixes
refactor: apply auto fixes from idea
This commit is contained in:
commit
2312e8b648
22 changed files with 154 additions and 159 deletions
|
@ -2,9 +2,6 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
interface EnhancedApps
|
||||
{
|
||||
public function test();
|
||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
|
@ -13,15 +13,16 @@ class HomeController extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function index()
|
||||
public function index(): RedirectResponse
|
||||
{
|
||||
return redirect()->route('dash');
|
||||
}
|
||||
|
|
|
@ -5,17 +5,16 @@ namespace App\Http\Controllers;
|
|||
use App\Application;
|
||||
use App\Item;
|
||||
use App\Jobs\ProcessApps;
|
||||
use App\Search;
|
||||
use App\Setting;
|
||||
use App\SupportedApps;
|
||||
use App\User;
|
||||
use Artisan;
|
||||
use GrahamCampbell\GitHub\Facades\GitHub;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Exception\ServerException;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
|
@ -23,15 +22,16 @@ class ItemController extends Controller
|
|||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware('allowed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource on the dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return View
|
||||
*/
|
||||
public function dash()
|
||||
public function dash(): View
|
||||
{
|
||||
$data['apps'] = Item::whereHas('parents', function ($query) {
|
||||
$query->where('id', 0);
|
||||
|
@ -49,7 +49,7 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Set order on the dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return void
|
||||
*/
|
||||
public function setOrder(Request $request)
|
||||
{
|
||||
|
@ -64,9 +64,10 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Pin item on the dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param $id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function pin($id)
|
||||
public function pin($id): RedirectResponse
|
||||
{
|
||||
$item = Item::findOrFail($id);
|
||||
$item->pinned = true;
|
||||
|
@ -79,9 +80,10 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Unpin item on the dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param $id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function unpin($id)
|
||||
public function unpin($id): RedirectResponse
|
||||
{
|
||||
$item = Item::findOrFail($id);
|
||||
$item->pinned = false;
|
||||
|
@ -94,12 +96,12 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Unpin item on the dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse|View
|
||||
*/
|
||||
public function pinToggle($id, $ajax = false, $tag = false)
|
||||
{
|
||||
$item = Item::findOrFail($id);
|
||||
$new = ((bool) $item->pinned === true) ? false : true;
|
||||
$new = !(((bool)$item->pinned === true));
|
||||
$item->pinned = $new;
|
||||
$item->save();
|
||||
if ($ajax) {
|
||||
|
@ -122,7 +124,7 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -140,9 +142,9 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): View
|
||||
{
|
||||
//
|
||||
$data['tags'] = Item::ofType('tag')->orderBy('title', 'asc')->pluck('title', 'id');
|
||||
|
@ -156,9 +158,9 @@ class ItemController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return View
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(int $id): View
|
||||
{
|
||||
// Get the item
|
||||
$item = Item::find($id);
|
||||
|
@ -226,7 +228,7 @@ class ItemController extends Controller
|
|||
$current_user = User::currentUser();
|
||||
$request->merge([
|
||||
'description' => $config,
|
||||
'user_id' => $current_user->id,
|
||||
'user_id' => $current_user->getId(),
|
||||
]);
|
||||
|
||||
if ($request->input('appid') === 'null') {
|
||||
|
@ -252,10 +254,10 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->storelogic($request);
|
||||
|
||||
|
@ -269,9 +271,9 @@ class ItemController extends Controller
|
|||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return void
|
||||
*/
|
||||
public function show($id)
|
||||
public function show(int $id): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -279,11 +281,11 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
$this->storelogic($request, $id);
|
||||
$route = route('dash', []);
|
||||
|
@ -295,10 +297,11 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request, $id)
|
||||
public function destroy(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
$force = (bool) $request->input('force');
|
||||
|
@ -320,9 +323,9 @@ class ItemController extends Controller
|
|||
* Restore the specified resource from soft deletion.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function restore($id)
|
||||
public function restore(int $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
Item::withTrashed()
|
||||
|
@ -338,9 +341,10 @@ class ItemController extends Controller
|
|||
/**
|
||||
* Return details for supported apps
|
||||
*
|
||||
* @return Json
|
||||
* @param Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
public function appload(Request $request)
|
||||
public function appload(Request $request): ?string
|
||||
{
|
||||
$output = [];
|
||||
$appid = $request->input('app');
|
||||
|
@ -429,10 +433,10 @@ class ItemController extends Controller
|
|||
|
||||
try {
|
||||
return $client->request($method, $url, $attrs);
|
||||
} catch (\GuzzleHttp\Exception\ConnectException $e) {
|
||||
} catch (ConnectException $e) {
|
||||
Log::error('Connection refused');
|
||||
Log::debug($e->getMessage());
|
||||
} catch (\GuzzleHttp\Exception\ServerException $e) {
|
||||
} catch (ServerException $e) {
|
||||
Log::debug($e->getMessage());
|
||||
}
|
||||
|
||||
|
@ -441,7 +445,7 @@ class ItemController extends Controller
|
|||
|
||||
public function websitelookup($url)
|
||||
{
|
||||
$url = \base64_decode($url);
|
||||
$url = base64_decode($url);
|
||||
$data = $this->execute($url);
|
||||
|
||||
return $data->getBody();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Search;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Setting;
|
||||
use App\SettingGroup;
|
||||
use App\User;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware('allowed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
* @return View
|
||||
*/
|
||||
public function index()
|
||||
public function index(): View
|
||||
{
|
||||
$settings = SettingGroup::with([
|
||||
'settings',
|
||||
|
@ -33,9 +33,9 @@ class SettingsController extends Controller
|
|||
/**
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return RedirectResponse|View
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(int $id)
|
||||
{
|
||||
$setting = Setting::find($id);
|
||||
//die("s: ".$setting->label);
|
||||
|
@ -59,11 +59,12 @@ class SettingsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
$setting = Setting::find($id);
|
||||
$user = $this->user();
|
||||
|
@ -104,9 +105,9 @@ class SettingsController extends Controller
|
|||
/**
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function clear($id)
|
||||
public function clear(int $id): RedirectResponse
|
||||
{
|
||||
$user = $this->user();
|
||||
$setting = Setting::find($id);
|
||||
|
|
|
@ -5,7 +5,10 @@ namespace App\Http\Controllers;
|
|||
use App\Item;
|
||||
use App\User;
|
||||
use DB;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
|
@ -17,7 +20,7 @@ class TagController extends Controller
|
|||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -35,7 +38,7 @@ class TagController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
@ -47,10 +50,10 @@ class TagController extends Controller
|
|||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'title' => 'required|max:255',
|
||||
|
@ -71,7 +74,7 @@ class TagController extends Controller
|
|||
$request->merge([
|
||||
'type' => '1',
|
||||
'url' => $slug,
|
||||
'user_id' => $current_user->id,
|
||||
'user_id' => $current_user->getId(),
|
||||
]);
|
||||
//die(print_r($request->all()));
|
||||
Item::create($request->all());
|
||||
|
@ -85,10 +88,10 @@ class TagController extends Controller
|
|||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param $slug
|
||||
* @return View
|
||||
*/
|
||||
public function show($slug)
|
||||
public function show($slug): View
|
||||
{
|
||||
$item = Item::whereUrl($slug)->first();
|
||||
//print_r($item);
|
||||
|
@ -103,9 +106,9 @@ class TagController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return View
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(int $id): View
|
||||
{
|
||||
// Get the item
|
||||
$item = Item::find($id);
|
||||
|
@ -118,11 +121,11 @@ class TagController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'title' => 'required|max:255',
|
||||
|
@ -153,9 +156,9 @@ class TagController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request, $id)
|
||||
public function destroy(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
$force = (bool) $request->input('force');
|
||||
|
@ -177,9 +180,9 @@ class TagController extends Controller
|
|||
* Restore the specified resource from soft deletion.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function restore($id)
|
||||
public function restore(int $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
Item::withTrashed()
|
||||
|
@ -191,9 +194,15 @@ class TagController extends Controller
|
|||
->with('success', __('app.alert.success.item_restored'));
|
||||
}
|
||||
|
||||
public function add($tag, $item)
|
||||
/**
|
||||
* Add item to tag
|
||||
*
|
||||
* @param $tag
|
||||
* @param $item
|
||||
* @return int 1|0
|
||||
*/
|
||||
public function add($tag, $item): int
|
||||
{
|
||||
$output = 0;
|
||||
$tag = Item::find($tag);
|
||||
$item = Item::find($item);
|
||||
if ($tag && $item) {
|
||||
|
@ -205,6 +214,6 @@ class TagController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\User;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
|
@ -12,15 +13,16 @@ class UserController extends Controller
|
|||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware('allowed')->except(['selectUser']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return View
|
||||
*/
|
||||
public function index()
|
||||
public function index(): View
|
||||
{
|
||||
$data['users'] = User::all();
|
||||
|
||||
|
@ -30,9 +32,9 @@ class UserController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): View
|
||||
{
|
||||
$data = [];
|
||||
|
||||
|
@ -50,10 +52,10 @@ class UserController extends Controller
|
|||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'username' => 'required|max:255|unique:users',
|
||||
|
@ -93,9 +95,9 @@ class UserController extends Controller
|
|||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return void
|
||||
*/
|
||||
public function show($id)
|
||||
public function show(int $id): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -103,10 +105,10 @@ class UserController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param User $user
|
||||
* @return View
|
||||
*/
|
||||
public function edit(User $user)
|
||||
public function edit(User $user): View
|
||||
{
|
||||
$data['user'] = $user;
|
||||
|
||||
|
@ -116,11 +118,11 @@ class UserController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @param User $user
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, User $user)
|
||||
public function update(Request $request, User $user): RedirectResponse
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'username' => 'required|max:255|unique:users,username,'.$user->id,
|
||||
|
@ -163,10 +165,10 @@ class UserController extends Controller
|
|||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param User $user
|
||||
* @return RedirectResponse | void
|
||||
*/
|
||||
public function destroy(User $user)
|
||||
public function destroy(User $user): RedirectResponse
|
||||
{
|
||||
if ($user->id !== 1) {
|
||||
$user->delete();
|
||||
|
|
|
@ -23,7 +23,7 @@ class CheckAllowed
|
|||
$current_user = User::currentUser();
|
||||
|
||||
if (str_is('users*', $route)) {
|
||||
if ($current_user->id !== 1) {
|
||||
if ($current_user->getId() !== 1) {
|
||||
return redirect()->route('dash');
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class CheckAllowed
|
|||
// Check if user is logged in as $current_user
|
||||
if (Auth::check()) {
|
||||
$loggedin_user = Auth::user();
|
||||
if ($loggedin_user->id === $current_user->id) {
|
||||
if ($loggedin_user->id === $current_user->getId()) {
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use App\Application;
|
||||
use App\ItemTag;
|
||||
use App\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
@ -21,7 +18,7 @@ class Item extends Model
|
|||
static::addGlobalScope('user_id', function (Builder $builder) {
|
||||
$current_user = User::currentUser();
|
||||
if ($current_user) {
|
||||
$builder->where('user_id', $current_user->id)->orWhere('user_id', 0);
|
||||
$builder->where('user_id', $current_user->getId())->orWhere('user_id', 0);
|
||||
} else {
|
||||
$builder->where('user_id', 0);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
|
@ -2,12 +2,8 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use App\Item;
|
||||
use App\Setting;
|
||||
use Cache;
|
||||
use Form;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Yaml;
|
||||
|
||||
abstract class Search
|
||||
|
@ -15,7 +11,7 @@ abstract class Search
|
|||
/**
|
||||
* List of all search providers
|
||||
*
|
||||
* @return array
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public static function providers()
|
||||
{
|
||||
|
@ -28,7 +24,7 @@ abstract class Search
|
|||
/**
|
||||
* Gets details for a single provider
|
||||
*
|
||||
* @return object
|
||||
* @return false|object
|
||||
*/
|
||||
public static function providerDetails($provider)
|
||||
{
|
||||
|
@ -45,7 +41,7 @@ abstract class Search
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function standardProviders()
|
||||
public static function standardProviders(): array
|
||||
{
|
||||
// $providers = json_decode(file_get_contents(storage_path('app/searchproviders.json')));
|
||||
// print_r($providers);
|
||||
|
@ -94,9 +90,9 @@ abstract class Search
|
|||
/**
|
||||
* Outputs the search form
|
||||
*
|
||||
* @return html
|
||||
* @return string
|
||||
*/
|
||||
public static function form()
|
||||
public static function form(): string
|
||||
{
|
||||
$output = '';
|
||||
$homepage_search = Setting::fetch('homepage_search');
|
||||
|
@ -111,7 +107,7 @@ abstract class Search
|
|||
}
|
||||
$user_search_provider = $user_search_provider ?? 'none';
|
||||
|
||||
if ((bool) $homepage_search && (bool) $search_provider) {
|
||||
if ((bool) $search_provider) {
|
||||
if ((bool) $user_search_provider) {
|
||||
$name = 'app.options.'.$user_search_provider;
|
||||
$provider = self::providerDetails($user_search_provider);
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
interface SearchInterface
|
||||
{
|
||||
public function getResults($query, $providerdetails);
|
||||
|
|
|
@ -2,12 +2,9 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use App\Search;
|
||||
use App\User;
|
||||
use Form;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
class Setting extends Model
|
||||
|
@ -38,9 +35,10 @@ class Setting extends Model
|
|||
protected static $cache = [];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @param Request $request
|
||||
* @return object
|
||||
*/
|
||||
public static function getInput(Request $request)
|
||||
public static function getInput(Request $request): object
|
||||
{
|
||||
return (object) [
|
||||
'value' => $request->input('value'),
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
abstract class SupportedApps
|
||||
|
|
18
app/User.php
18
app/User.php
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
|
@ -27,20 +29,28 @@ class User extends Authenticatable
|
|||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items for the user.
|
||||
*/
|
||||
public function items()
|
||||
public function items(): HasMany
|
||||
{
|
||||
return $this->hasMany(\App\Item::class);
|
||||
return $this->hasMany(Item::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* The settings that belong to the user.
|
||||
*/
|
||||
public function settings()
|
||||
public function settings(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(\App\Setting::class)->withPivot('uservalue');
|
||||
return $this->belongsToMany(Setting::class)->withPivot('uservalue');
|
||||
}
|
||||
|
||||
public static function currentUser()
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
"laravel/ui": "^3.0",
|
||||
"laravelcollective/html": "^6.0",
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"symfony/yaml": "^5.4"
|
||||
"symfony/yaml": "^5.4",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"filp/whoops": "~2.0",
|
||||
|
|
6
vendor/composer/autoload_classmap.php
vendored
6
vendor/composer/autoload_classmap.php
vendored
|
@ -43,12 +43,6 @@ return array(
|
|||
'App\\SettingGroup' => $baseDir . '/app/SettingGroup.php',
|
||||
'App\\SettingUser' => $baseDir . '/app/SettingUser.php',
|
||||
'App\\SupportedApps' => $baseDir . '/app/SupportedApps.php',
|
||||
'App\\SupportedApps\\Ackee\\Ackee' => $baseDir . '/app/SupportedApps/Ackee/Ackee.php',
|
||||
'App\\SupportedApps\\Airsonic\\Airsonic' => $baseDir . '/app/SupportedApps/Airsonic/Airsonic.php',
|
||||
'App\\SupportedApps\\ArchiveBox\\ArchiveBox' => $baseDir . '/app/SupportedApps/ArchiveBox/ArchiveBox.php',
|
||||
'App\\SupportedApps\\AriaNg\\AriaNg' => $baseDir . '/app/SupportedApps/AriaNg/AriaNg.php',
|
||||
'App\\SupportedApps\\Artifactory\\Artifactory' => $baseDir . '/app/SupportedApps/Artifactory/Artifactory.php',
|
||||
'App\\SupportedApps\\XP900\\XP900' => $baseDir . '/app/SupportedApps/XP900/XP900.php',
|
||||
'App\\User' => $baseDir . '/app/User.php',
|
||||
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
||||
'Brick\\Math\\BigDecimal' => $vendorDir . '/brick/math/src/BigDecimal.php',
|
||||
|
|
6
vendor/composer/autoload_static.php
vendored
6
vendor/composer/autoload_static.php
vendored
|
@ -641,12 +641,6 @@ class ComposerStaticInit4b6fb9210a1ea37c2db27b8ff53a1ecf
|
|||
'App\\SettingGroup' => __DIR__ . '/../..' . '/app/SettingGroup.php',
|
||||
'App\\SettingUser' => __DIR__ . '/../..' . '/app/SettingUser.php',
|
||||
'App\\SupportedApps' => __DIR__ . '/../..' . '/app/SupportedApps.php',
|
||||
'App\\SupportedApps\\Ackee\\Ackee' => __DIR__ . '/../..' . '/app/SupportedApps/Ackee/Ackee.php',
|
||||
'App\\SupportedApps\\Airsonic\\Airsonic' => __DIR__ . '/../..' . '/app/SupportedApps/Airsonic/Airsonic.php',
|
||||
'App\\SupportedApps\\ArchiveBox\\ArchiveBox' => __DIR__ . '/../..' . '/app/SupportedApps/ArchiveBox/ArchiveBox.php',
|
||||
'App\\SupportedApps\\AriaNg\\AriaNg' => __DIR__ . '/../..' . '/app/SupportedApps/AriaNg/AriaNg.php',
|
||||
'App\\SupportedApps\\Artifactory\\Artifactory' => __DIR__ . '/../..' . '/app/SupportedApps/Artifactory/Artifactory.php',
|
||||
'App\\SupportedApps\\XP900\\XP900' => __DIR__ . '/../..' . '/app/SupportedApps/XP900/XP900.php',
|
||||
'App\\User' => __DIR__ . '/../..' . '/app/User.php',
|
||||
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
||||
'Brick\\Math\\BigDecimal' => __DIR__ . '/..' . '/brick/math/src/BigDecimal.php',
|
||||
|
|
12
vendor/composer/installed.php
vendored
12
vendor/composer/installed.php
vendored
|
@ -3,7 +3,7 @@
|
|||
'name' => 'laravel/laravel',
|
||||
'pretty_version' => '2.x-dev',
|
||||
'version' => '2.9999999.9999999.9999999-dev',
|
||||
'reference' => '64c1e1d0081c06869677f0100fd2df5c40722555',
|
||||
'reference' => 'a21b50a6abf439fc7c3c1a3f62a2b4e43b8f6391',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
@ -433,7 +433,7 @@
|
|||
'laravel/laravel' => array(
|
||||
'pretty_version' => '2.x-dev',
|
||||
'version' => '2.9999999.9999999.9999999-dev',
|
||||
'reference' => '64c1e1d0081c06869677f0100fd2df5c40722555',
|
||||
'reference' => 'a21b50a6abf439fc7c3c1a3f62a2b4e43b8f6391',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
@ -859,8 +859,8 @@
|
|||
'psr/log-implementation' => array(
|
||||
'dev_requirement' => false,
|
||||
'provided' => array(
|
||||
0 => '1.0|2.0',
|
||||
1 => '1.0.0 || 2.0.0 || 3.0.0',
|
||||
0 => '1.0.0 || 2.0.0 || 3.0.0',
|
||||
1 => '1.0|2.0',
|
||||
),
|
||||
),
|
||||
'psr/simple-cache' => array(
|
||||
|
@ -875,8 +875,8 @@
|
|||
'psr/simple-cache-implementation' => array(
|
||||
'dev_requirement' => false,
|
||||
'provided' => array(
|
||||
0 => '1.0|2.0',
|
||||
1 => '1.0',
|
||||
0 => '1.0',
|
||||
1 => '1.0|2.0',
|
||||
),
|
||||
),
|
||||
'psy/psysh' => array(
|
||||
|
|
Loading…
Reference in a new issue