refactor: apply auto fixes from idea

This commit is contained in:
Attila Kerekes 2022-11-14 13:21:47 +01:00 committed by Attila Jozsef Kerekes
parent d4f7ad842c
commit b390a719e9
No known key found for this signature in database
GPG key ID: E1121565A016ADFD
22 changed files with 154 additions and 159 deletions

View file

@ -2,9 +2,6 @@
namespace App; namespace App;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
interface EnhancedApps interface EnhancedApps
{ {
public function test(); public function test();

View file

@ -7,7 +7,6 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Auth;
class Controller extends BaseController class Controller extends BaseController
{ {

View file

@ -2,7 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\RedirectResponse;
class HomeController extends Controller class HomeController extends Controller
{ {
@ -13,15 +13,16 @@ class HomeController extends Controller
*/ */
public function __construct() public function __construct()
{ {
parent::__construct();
$this->middleware('auth'); $this->middleware('auth');
} }
/** /**
* Show the application dashboard. * Show the application dashboard.
* *
* @return \Illuminate\Http\Response * @return RedirectResponse
*/ */
public function index() public function index(): RedirectResponse
{ {
return redirect()->route('dash'); return redirect()->route('dash');
} }

View file

@ -5,17 +5,16 @@ namespace App\Http\Controllers;
use App\Application; use App\Application;
use App\Item; use App\Item;
use App\Jobs\ProcessApps; use App\Jobs\ProcessApps;
use App\Search;
use App\Setting;
use App\SupportedApps;
use App\User; use App\User;
use Artisan; use Artisan;
use GrahamCampbell\GitHub\Facades\GitHub;
use GuzzleHttp\Client; 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\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL; use Illuminate\Support\Facades\URL;
@ -23,15 +22,16 @@ class ItemController extends Controller
{ {
public function __construct() public function __construct()
{ {
parent::__construct();
$this->middleware('allowed'); $this->middleware('allowed');
} }
/** /**
* Display a listing of the resource on the dashboard. * 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) { $data['apps'] = Item::whereHas('parents', function ($query) {
$query->where('id', 0); $query->where('id', 0);
@ -49,7 +49,7 @@ class ItemController extends Controller
/** /**
* Set order on the dashboard. * Set order on the dashboard.
* *
* @return \Illuminate\Http\Response * @return void
*/ */
public function setOrder(Request $request) public function setOrder(Request $request)
{ {
@ -64,9 +64,10 @@ class ItemController extends Controller
/** /**
* Pin item on the dashboard. * 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 = Item::findOrFail($id);
$item->pinned = true; $item->pinned = true;
@ -79,9 +80,10 @@ class ItemController extends Controller
/** /**
* Unpin item on the dashboard. * 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 = Item::findOrFail($id);
$item->pinned = false; $item->pinned = false;
@ -94,12 +96,12 @@ class ItemController extends Controller
/** /**
* Unpin item on the dashboard. * Unpin item on the dashboard.
* *
* @return \Illuminate\Http\Response * @return RedirectResponse|View
*/ */
public function pinToggle($id, $ajax = false, $tag = false) public function pinToggle($id, $ajax = false, $tag = false)
{ {
$item = Item::findOrFail($id); $item = Item::findOrFail($id);
$new = ((bool) $item->pinned === true) ? false : true; $new = !(((bool)$item->pinned === true));
$item->pinned = $new; $item->pinned = $new;
$item->save(); $item->save();
if ($ajax) { if ($ajax) {
@ -122,7 +124,7 @@ class ItemController extends Controller
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
* @return \Illuminate\Http\Response * @return View
*/ */
public function index(Request $request) public function index(Request $request)
{ {
@ -140,9 +142,9 @@ class ItemController extends Controller
/** /**
* Show the form for creating a new resource. * 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'); $data['tags'] = Item::ofType('tag')->orderBy('title', 'asc')->pluck('title', 'id');
@ -155,10 +157,10 @@ class ItemController extends Controller
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return View
*/ */
public function edit($id) public function edit(int $id): View
{ {
// Get the item // Get the item
$item = Item::find($id); $item = Item::find($id);
@ -226,7 +228,7 @@ class ItemController extends Controller
$current_user = User::currentUser(); $current_user = User::currentUser();
$request->merge([ $request->merge([
'description' => $config, 'description' => $config,
'user_id' => $current_user->id, 'user_id' => $current_user->getId(),
]); ]);
if ($request->input('appid') === 'null') { if ($request->input('appid') === 'null') {
@ -252,10 +254,10 @@ class ItemController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param Request $request
* @return \Illuminate\Http\Response * @return RedirectResponse
*/ */
public function store(Request $request) public function store(Request $request): RedirectResponse
{ {
$this->storelogic($request); $this->storelogic($request);
@ -268,10 +270,10 @@ class ItemController extends Controller
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param int $id * @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. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param Request $request
* @param int $id * @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); $this->storelogic($request, $id);
$route = route('dash', []); $route = route('dash', []);
@ -295,10 +297,11 @@ class ItemController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param int $id * @param Request $request
* @return \Illuminate\Http\Response * @param int $id
* @return RedirectResponse
*/ */
public function destroy(Request $request, $id) public function destroy(Request $request, int $id): RedirectResponse
{ {
// //
$force = (bool) $request->input('force'); $force = (bool) $request->input('force');
@ -319,10 +322,10 @@ class ItemController extends Controller
/** /**
* Restore the specified resource from soft deletion. * Restore the specified resource from soft deletion.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return RedirectResponse
*/ */
public function restore($id) public function restore(int $id): RedirectResponse
{ {
// //
Item::withTrashed() Item::withTrashed()
@ -338,9 +341,10 @@ class ItemController extends Controller
/** /**
* Return details for supported apps * 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 = []; $output = [];
$appid = $request->input('app'); $appid = $request->input('app');
@ -429,10 +433,10 @@ class ItemController extends Controller
try { try {
return $client->request($method, $url, $attrs); return $client->request($method, $url, $attrs);
} catch (\GuzzleHttp\Exception\ConnectException $e) { } catch (ConnectException $e) {
Log::error('Connection refused'); Log::error('Connection refused');
Log::debug($e->getMessage()); Log::debug($e->getMessage());
} catch (\GuzzleHttp\Exception\ServerException $e) { } catch (ServerException $e) {
Log::debug($e->getMessage()); Log::debug($e->getMessage());
} }
@ -441,7 +445,7 @@ class ItemController extends Controller
public function websitelookup($url) public function websitelookup($url)
{ {
$url = \base64_decode($url); $url = base64_decode($url);
$data = $this->execute($url); $data = $this->execute($url);
return $data->getBody(); return $data->getBody();

View file

@ -2,7 +2,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Search; use App\Search;
use Illuminate\Http\Request; use Illuminate\Http\Request;

View file

@ -2,24 +2,24 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Setting; use App\Setting;
use App\SettingGroup; use App\SettingGroup;
use App\User; use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class SettingsController extends Controller class SettingsController extends Controller
{ {
public function __construct() public function __construct()
{ {
parent::__construct();
$this->middleware('allowed'); $this->middleware('allowed');
} }
/** /**
* @return \Illuminate\View\View * @return View
*/ */
public function index() public function index(): View
{ {
$settings = SettingGroup::with([ $settings = SettingGroup::with([
'settings', 'settings',
@ -33,9 +33,9 @@ class SettingsController extends Controller
/** /**
* @param int $id * @param int $id
* *
* @return \Illuminate\Http\RedirectResponse * @return RedirectResponse|View
*/ */
public function edit($id) public function edit(int $id)
{ {
$setting = Setting::find($id); $setting = Setting::find($id);
//die("s: ".$setting->label); //die("s: ".$setting->label);
@ -59,11 +59,12 @@ class SettingsController extends Controller
} }
/** /**
* @param Request $request
* @param int $id * @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); $setting = Setting::find($id);
$user = $this->user(); $user = $this->user();
@ -104,9 +105,9 @@ class SettingsController extends Controller
/** /**
* @param int $id * @param int $id
* *
* @return \Illuminate\Http\RedirectResponse * @return RedirectResponse
*/ */
public function clear($id) public function clear(int $id): RedirectResponse
{ {
$user = $this->user(); $user = $this->user();
$setting = Setting::find($id); $setting = Setting::find($id);

View file

@ -5,7 +5,10 @@ namespace App\Http\Controllers;
use App\Item; use App\Item;
use App\User; use App\User;
use DB; use DB;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response;
class TagController extends Controller class TagController extends Controller
{ {
@ -17,7 +20,7 @@ class TagController extends Controller
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
* @return \Illuminate\Http\Response * @return Response
*/ */
public function index(Request $request) public function index(Request $request)
{ {
@ -35,7 +38,7 @@ class TagController extends Controller
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* *
* @return \Illuminate\Http\Response * @return Response
*/ */
public function create() public function create()
{ {
@ -47,10 +50,10 @@ class TagController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param Request $request
* @return \Illuminate\Http\Response * @return RedirectResponse
*/ */
public function store(Request $request) public function store(Request $request): RedirectResponse
{ {
$validatedData = $request->validate([ $validatedData = $request->validate([
'title' => 'required|max:255', 'title' => 'required|max:255',
@ -71,7 +74,7 @@ class TagController extends Controller
$request->merge([ $request->merge([
'type' => '1', 'type' => '1',
'url' => $slug, 'url' => $slug,
'user_id' => $current_user->id, 'user_id' => $current_user->getId(),
]); ]);
//die(print_r($request->all())); //die(print_r($request->all()));
Item::create($request->all()); Item::create($request->all());
@ -85,10 +88,10 @@ class TagController extends Controller
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param int $id * @param $slug
* @return \Illuminate\Http\Response * @return View
*/ */
public function show($slug) public function show($slug): View
{ {
$item = Item::whereUrl($slug)->first(); $item = Item::whereUrl($slug)->first();
//print_r($item); //print_r($item);
@ -102,10 +105,10 @@ class TagController extends Controller
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return View
*/ */
public function edit($id) public function edit(int $id): View
{ {
// Get the item // Get the item
$item = Item::find($id); $item = Item::find($id);
@ -118,11 +121,11 @@ class TagController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param Request $request
* @param int $id * @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([ $validatedData = $request->validate([
'title' => 'required|max:255', 'title' => 'required|max:255',
@ -152,10 +155,10 @@ class TagController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param int $id * @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'); $force = (bool) $request->input('force');
@ -176,10 +179,10 @@ class TagController extends Controller
/** /**
* Restore the specified resource from soft deletion. * Restore the specified resource from soft deletion.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return RedirectResponse
*/ */
public function restore($id) public function restore(int $id): RedirectResponse
{ {
// //
Item::withTrashed() Item::withTrashed()
@ -191,9 +194,15 @@ class TagController extends Controller
->with('success', __('app.alert.success.item_restored')); ->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); $tag = Item::find($tag);
$item = Item::find($item); $item = Item::find($item);
if ($tag && $item) { if ($tag && $item) {
@ -205,6 +214,6 @@ class TagController extends Controller
} }
} }
return $output; return 0;
} }
} }

View file

@ -2,8 +2,9 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\User; use App\User;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -12,15 +13,16 @@ class UserController extends Controller
{ {
public function __construct() public function __construct()
{ {
parent::__construct();
$this->middleware('allowed')->except(['selectUser']); $this->middleware('allowed')->except(['selectUser']);
} }
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
* @return \Illuminate\Http\Response * @return View
*/ */
public function index() public function index(): View
{ {
$data['users'] = User::all(); $data['users'] = User::all();
@ -30,9 +32,9 @@ class UserController extends Controller
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* *
* @return \Illuminate\Http\Response * @return View
*/ */
public function create() public function create(): View
{ {
$data = []; $data = [];
@ -50,10 +52,10 @@ class UserController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param Request $request
* @return \Illuminate\Http\Response * @return RedirectResponse
*/ */
public function store(Request $request) public function store(Request $request): RedirectResponse
{ {
$validatedData = $request->validate([ $validatedData = $request->validate([
'username' => 'required|max:255|unique:users', 'username' => 'required|max:255|unique:users',
@ -92,10 +94,10 @@ class UserController extends Controller
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param int $id * @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. * Show the form for editing the specified resource.
* *
* @param int $id * @param User $user
* @return \Illuminate\Http\Response * @return View
*/ */
public function edit(User $user) public function edit(User $user): View
{ {
$data['user'] = $user; $data['user'] = $user;
@ -116,11 +118,11 @@ class UserController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param Request $request
* @param int $id * @param User $user
* @return \Illuminate\Http\Response * @return RedirectResponse
*/ */
public function update(Request $request, User $user) public function update(Request $request, User $user): RedirectResponse
{ {
$validatedData = $request->validate([ $validatedData = $request->validate([
'username' => 'required|max:255|unique:users,username,'.$user->id, 'username' => 'required|max:255|unique:users,username,'.$user->id,
@ -163,10 +165,10 @@ class UserController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param int $id * @param User $user
* @return \Illuminate\Http\Response * @return RedirectResponse | void
*/ */
public function destroy(User $user) public function destroy(User $user): RedirectResponse
{ {
if ($user->id !== 1) { if ($user->id !== 1) {
$user->delete(); $user->delete();

View file

@ -23,7 +23,7 @@ class CheckAllowed
$current_user = User::currentUser(); $current_user = User::currentUser();
if (str_is('users*', $route)) { if (str_is('users*', $route)) {
if ($current_user->id !== 1) { if ($current_user->getId() !== 1) {
return redirect()->route('dash'); return redirect()->route('dash');
} }
} }
@ -43,7 +43,7 @@ class CheckAllowed
// Check if user is logged in as $current_user // Check if user is logged in as $current_user
if (Auth::check()) { if (Auth::check()) {
$loggedin_user = Auth::user(); $loggedin_user = Auth::user();
if ($loggedin_user->id === $current_user->id) { if ($loggedin_user->id === $current_user->getId()) {
return $next($request); return $next($request);
} }
} }

View file

@ -3,7 +3,6 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
use Symfony\Component\HttpFoundation\Cookie;
class VerifyCsrfToken extends Middleware class VerifyCsrfToken extends Middleware
{ {

View file

@ -2,9 +2,6 @@
namespace App; namespace App;
use App\Application;
use App\ItemTag;
use App\User;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@ -21,7 +18,7 @@ class Item extends Model
static::addGlobalScope('user_id', function (Builder $builder) { static::addGlobalScope('user_id', function (Builder $builder) {
$current_user = User::currentUser(); $current_user = User::currentUser();
if ($current_user) { 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 { } else {
$builder->where('user_id', 0); $builder->where('user_id', 0);
} }

View file

@ -3,7 +3,6 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider class AuthServiceProvider extends ServiceProvider
{ {

View file

@ -3,7 +3,6 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider class EventServiceProvider extends ServiceProvider
{ {

View file

@ -2,12 +2,8 @@
namespace App; namespace App;
use App\Item;
use App\Setting;
use Cache; use Cache;
use Form; use Form;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Yaml; use Yaml;
abstract class Search abstract class Search
@ -15,7 +11,7 @@ abstract class Search
/** /**
* List of all search providers * List of all search providers
* *
* @return array * @return \Illuminate\Support\Collection
*/ */
public static function providers() public static function providers()
{ {
@ -28,7 +24,7 @@ abstract class Search
/** /**
* Gets details for a single provider * Gets details for a single provider
* *
* @return object * @return false|object
*/ */
public static function providerDetails($provider) public static function providerDetails($provider)
{ {
@ -45,7 +41,7 @@ abstract class Search
* *
* @return array * @return array
*/ */
public static function standardProviders() public static function standardProviders(): array
{ {
// $providers = json_decode(file_get_contents(storage_path('app/searchproviders.json'))); // $providers = json_decode(file_get_contents(storage_path('app/searchproviders.json')));
// print_r($providers); // print_r($providers);
@ -94,9 +90,9 @@ abstract class Search
/** /**
* Outputs the search form * Outputs the search form
* *
* @return html * @return string
*/ */
public static function form() public static function form(): string
{ {
$output = ''; $output = '';
$homepage_search = Setting::fetch('homepage_search'); $homepage_search = Setting::fetch('homepage_search');
@ -111,7 +107,7 @@ abstract class Search
} }
$user_search_provider = $user_search_provider ?? 'none'; $user_search_provider = $user_search_provider ?? 'none';
if ((bool) $homepage_search && (bool) $search_provider) { if ((bool) $search_provider) {
if ((bool) $user_search_provider) { if ((bool) $user_search_provider) {
$name = 'app.options.'.$user_search_provider; $name = 'app.options.'.$user_search_provider;
$provider = self::providerDetails($user_search_provider); $provider = self::providerDetails($user_search_provider);

View file

@ -2,9 +2,6 @@
namespace App; namespace App;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
interface SearchInterface interface SearchInterface
{ {
public function getResults($query, $providerdetails); public function getResults($query, $providerdetails);

View file

@ -2,12 +2,9 @@
namespace App; namespace App;
use App\Search;
use App\User;
use Form; use Form;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
class Setting extends Model class Setting extends Model
@ -38,9 +35,10 @@ class Setting extends Model
protected static $cache = []; 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) [ return (object) [
'value' => $request->input('value'), 'value' => $request->input('value'),

View file

@ -3,7 +3,6 @@
namespace App; namespace App;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
abstract class SupportedApps abstract class SupportedApps

View file

@ -2,6 +2,8 @@
namespace App; namespace App;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
@ -27,20 +29,28 @@ class User extends Authenticatable
'password', 'remember_token', 'password', 'remember_token',
]; ];
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/** /**
* Get the items for the user. * 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. * 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() public static function currentUser()

View file

@ -18,7 +18,8 @@
"laravel/ui": "^3.0", "laravel/ui": "^3.0",
"laravelcollective/html": "^6.0", "laravelcollective/html": "^6.0",
"nunomaduro/collision": "^5.0", "nunomaduro/collision": "^5.0",
"symfony/yaml": "^5.4" "symfony/yaml": "^5.4",
"ext-json": "*"
}, },
"require-dev": { "require-dev": {
"filp/whoops": "~2.0", "filp/whoops": "~2.0",

View file

@ -43,12 +43,6 @@ return array(
'App\\SettingGroup' => $baseDir . '/app/SettingGroup.php', 'App\\SettingGroup' => $baseDir . '/app/SettingGroup.php',
'App\\SettingUser' => $baseDir . '/app/SettingUser.php', 'App\\SettingUser' => $baseDir . '/app/SettingUser.php',
'App\\SupportedApps' => $baseDir . '/app/SupportedApps.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', 'App\\User' => $baseDir . '/app/User.php',
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Brick\\Math\\BigDecimal' => $vendorDir . '/brick/math/src/BigDecimal.php', 'Brick\\Math\\BigDecimal' => $vendorDir . '/brick/math/src/BigDecimal.php',

View file

@ -641,12 +641,6 @@ class ComposerStaticInit4b6fb9210a1ea37c2db27b8ff53a1ecf
'App\\SettingGroup' => __DIR__ . '/../..' . '/app/SettingGroup.php', 'App\\SettingGroup' => __DIR__ . '/../..' . '/app/SettingGroup.php',
'App\\SettingUser' => __DIR__ . '/../..' . '/app/SettingUser.php', 'App\\SettingUser' => __DIR__ . '/../..' . '/app/SettingUser.php',
'App\\SupportedApps' => __DIR__ . '/../..' . '/app/SupportedApps.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', 'App\\User' => __DIR__ . '/../..' . '/app/User.php',
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Brick\\Math\\BigDecimal' => __DIR__ . '/..' . '/brick/math/src/BigDecimal.php', 'Brick\\Math\\BigDecimal' => __DIR__ . '/..' . '/brick/math/src/BigDecimal.php',

View file

@ -3,7 +3,7 @@
'name' => 'laravel/laravel', 'name' => 'laravel/laravel',
'pretty_version' => '2.x-dev', 'pretty_version' => '2.x-dev',
'version' => '2.9999999.9999999.9999999-dev', 'version' => '2.9999999.9999999.9999999-dev',
'reference' => '64c1e1d0081c06869677f0100fd2df5c40722555', 'reference' => 'a21b50a6abf439fc7c3c1a3f62a2b4e43b8f6391',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -433,7 +433,7 @@
'laravel/laravel' => array( 'laravel/laravel' => array(
'pretty_version' => '2.x-dev', 'pretty_version' => '2.x-dev',
'version' => '2.9999999.9999999.9999999-dev', 'version' => '2.9999999.9999999.9999999-dev',
'reference' => '64c1e1d0081c06869677f0100fd2df5c40722555', 'reference' => 'a21b50a6abf439fc7c3c1a3f62a2b4e43b8f6391',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -859,8 +859,8 @@
'psr/log-implementation' => array( 'psr/log-implementation' => array(
'dev_requirement' => false, 'dev_requirement' => false,
'provided' => array( 'provided' => array(
0 => '1.0|2.0', 0 => '1.0.0 || 2.0.0 || 3.0.0',
1 => '1.0.0 || 2.0.0 || 3.0.0', 1 => '1.0|2.0',
), ),
), ),
'psr/simple-cache' => array( 'psr/simple-cache' => array(
@ -875,8 +875,8 @@
'psr/simple-cache-implementation' => array( 'psr/simple-cache-implementation' => array(
'dev_requirement' => false, 'dev_requirement' => false,
'provided' => array( 'provided' => array(
0 => '1.0|2.0', 0 => '1.0',
1 => '1.0', 1 => '1.0|2.0',
), ),
), ),
'psy/psysh' => array( 'psy/psysh' => array(