Merge pull request #8 from KodeStar/shift-110368

Laravel 10.x Shift
This commit is contained in:
KodeStar
2024-02-16 21:30:12 +00:00
committed by GitHub
78 changed files with 326 additions and 641 deletions

View File

@@ -66,17 +66,11 @@ class Application extends Model
return $this->icon;
}
/**
* @return string
*/
public function iconView(): string
{
return asset('storage/'.$this->icon);
}
/**
* @return string
*/
public function defaultColour(): string
{
// check if light or dark
@@ -87,9 +81,6 @@ class Application extends Model
return '#161b1f';
}
/**
* @return string
*/
public function class(): string
{
$name = $this->name;
@@ -100,7 +91,6 @@ class Application extends Model
/**
* @param $name
* @return string
*/
public static function classFromName($name): string
{
@@ -111,9 +101,6 @@ class Application extends Model
return $class;
}
/**
* @return Collection
*/
public static function apps(): Collection
{
$json = json_decode(file_get_contents(storage_path('app/supportedapps.json'))) ?? [];
@@ -122,9 +109,6 @@ class Application extends Model
return $apps->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE);
}
/**
* @return array
*/
public static function autocomplete(): array
{
$apps = self::apps();
@@ -193,9 +177,6 @@ class Application extends Model
return $app;
}
/**
* @return array
*/
public static function applist(): array
{
$list = [];

View File

@@ -35,10 +35,8 @@ class RegisterApp extends Command
/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): void
{
$folder = $this->argument('folder');
if ($folder == 'all') {
@@ -56,10 +54,8 @@ class RegisterApp extends Command
/**
* @param $folder
* @param bool $remove
* @return void
*/
public function addApp($folder, bool $remove = false)
public function addApp($folder, bool $remove = false): void
{
$json = app_path('SupportedApps/'.$folder.'/app.json');
@@ -96,9 +92,8 @@ class RegisterApp extends Command
/**
* @param $appFolder
* @param $icon
* @return void
*/
private function saveIcon($appFolder, $icon)
private function saveIcon($appFolder, $icon): void
{
$iconPath = app_path('SupportedApps/' . $appFolder . '/' . $icon);
$contents = file_get_contents($iconPath);

View File

@@ -9,11 +9,8 @@ class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')
// ->hourly();
@@ -21,10 +18,8 @@ class Kernel extends ConsoleKernel
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

View File

@@ -8,25 +8,7 @@ use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed to the session on validation exceptions.
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
@@ -38,10 +20,8 @@ class Handler extends ExceptionHandler
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
public function register(): void
{
$this->reportable(function (Throwable $e) {
//

View File

@@ -49,9 +49,6 @@ class LoginController extends Controller
$this->middleware('guest')->except(['logout','autologin']);
}
/**
* @return string
*/
public function username(): string
{
return 'username';
@@ -60,8 +57,6 @@ class LoginController extends Controller
/**
* Handle a login request to the application.
*
* @param Request $request
* @return Response
*
* @throws ValidationException
*/
@@ -97,10 +92,6 @@ class LoginController extends Controller
{
}
/**
* @param User $user
* @return RedirectResponse
*/
public function setUser(User $user): RedirectResponse
{
Auth::logout();
@@ -111,7 +102,6 @@ class LoginController extends Controller
/**
* @param $uuid
* @return RedirectResponse
*/
public function autologin($uuid): RedirectResponse
{
@@ -135,15 +125,13 @@ class LoginController extends Controller
*
* @return Application|Factory|View
*/
public function showLoginForm()
public function showLoginForm(): \Illuminate\View\View
{
return view('auth.login');
}
/**
* @param Request $request
* @param $user
* @return RedirectResponse
*/
protected function authenticated(Request $request, $user): RedirectResponse
{

View File

@@ -41,9 +41,6 @@ class RegisterController extends Controller
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data): \Illuminate\Contracts\Validation\Validator
{
@@ -56,11 +53,8 @@ class RegisterController extends Controller
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
protected function create(array $data): User
{
return User::create([
'name' => $data['name'],

View File

@@ -4,13 +4,12 @@ namespace App\Http\Controllers;
use App\User;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests, ValidatesRequests;
protected $user;

View File

@@ -12,17 +12,11 @@ use Illuminate\Support\Facades\RateLimiter;
class HealthController extends Controller
{
/**
* @return int
*/
private static function getUsers(): int
{
return User::count();
}
/**
* @return int
*/
private static function getItems(): int
{
return Item::select('id')
@@ -34,7 +28,6 @@ class HealthController extends Controller
/**
* Handle the incoming request.
*
* @param Request $request
* @return JsonResponse|Response
* @throws BindingResolutionException
*/

View File

@@ -19,8 +19,6 @@ class HomeController extends Controller
/**
* Show the application dashboard.
*
* @return RedirectResponse
*/
public function index(): RedirectResponse
{

View File

@@ -20,9 +20,6 @@ class ImportController extends Controller
/**
* Handle the incoming request.
*
* @param Request $request
* @return View
*/
public function __invoke(Request $request): View
{

View File

@@ -32,8 +32,6 @@ class ItemController extends Controller
/**
* Display a listing of the resource on the dashboard.
*
* @return View
*/
public function dash(): View
{
@@ -69,7 +67,6 @@ class ItemController extends Controller
* Pin item on the dashboard.
*
* @param $id
* @return RedirectResponse
*/
public function pin($id): RedirectResponse
{
@@ -85,7 +82,6 @@ class ItemController extends Controller
* Unpin item on the dashboard.
*
* @param $id
* @return RedirectResponse
*/
public function unpin($id): RedirectResponse
{
@@ -135,9 +131,6 @@ class ItemController extends Controller
/**
* Display a listing of the resource.
*
* @param Request $request
* @return View
*/
public function index(Request $request): View
{
@@ -154,8 +147,6 @@ class ItemController extends Controller
/**
* Show the form for creating a new resource.
*
* @return View
*/
public function create(): View
{
@@ -169,9 +160,6 @@ class ItemController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return View
*/
public function edit(int $id): View
{
@@ -194,9 +182,7 @@ class ItemController extends Controller
}
/**
* @param Request $request
* @param null $id
* @return Item
* @throws ValidationException
*/
public static function storelogic(Request $request, $id = null): Item
@@ -287,9 +273,6 @@ class ItemController extends Controller
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return RedirectResponse
*/
public function store(Request $request): RedirectResponse
{
@@ -303,9 +286,6 @@ class ItemController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @return void
*/
public function show(int $id): void
{
@@ -314,10 +294,6 @@ class ItemController extends Controller
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return RedirectResponse
*/
public function update(Request $request, int $id): RedirectResponse
{
@@ -330,10 +306,6 @@ class ItemController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Request $request
* @param int $id
* @return RedirectResponse
*/
public function destroy(Request $request, int $id): RedirectResponse
{
@@ -355,9 +327,6 @@ class ItemController extends Controller
/**
* Restore the specified resource from soft deletion.
*
* @param int $id
* @return RedirectResponse
*/
public function restore(int $id): RedirectResponse
{
@@ -375,8 +344,6 @@ class ItemController extends Controller
/**
* Return details for supported apps
*
* @param Request $request
* @return string|null
* @throws GuzzleException
*/
public function appload(Request $request): ?string
@@ -419,7 +386,6 @@ class ItemController extends Controller
}
/**
* @param Request $request
* @return void
*/
public function testConfig(Request $request)
@@ -448,9 +414,7 @@ class ItemController extends Controller
/**
* @param $url
* @param array $attrs
* @param array|bool $overridevars
* @return ResponseInterface|null
* @throws GuzzleException
*/
public function execute($url, array $attrs = [], $overridevars = false): ?ResponseInterface
@@ -481,7 +445,6 @@ class ItemController extends Controller
/**
* @param $url
* @return StreamInterface
* @throws GuzzleException
*/
public function websitelookup($url): StreamInterface
@@ -511,7 +474,7 @@ class ItemController extends Controller
/**
* @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|Redirector
*/
public function checkAppList()
public function checkAppList(): RedirectResponse
{
ProcessApps::dispatch();
$route = route('items.index');

View File

@@ -17,10 +17,8 @@ class ItemRestController extends Controller
/**
* Display a listing of the resource.
*
* @return Collection
*/
public function index()
public function index(): Collection
{
$columns = [
'title',
@@ -49,9 +47,6 @@ class ItemRestController extends Controller
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return object
*/
public function store(Request $request): object
{
@@ -66,45 +61,32 @@ class ItemRestController extends Controller
/**
* Display the specified resource.
*
* @param Item $item
* @return Response
*/
public function show(Item $item)
public function show(Item $item): Response
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param Item $item
* @return Response
*/
public function edit(Item $item)
public function edit(Item $item): Response
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param Item $item
* @return Response
*/
public function update(Request $request, Item $item)
public function update(Request $request, Item $item): Response
{
//
}
/**
* Remove the specified resource from storage.
*
* @param Item $item
* @return Response
*/
public function destroy(Item $item)
public function destroy(Item $item): Response
{
//
}

View File

@@ -11,7 +11,6 @@ use Illuminate\Routing\Redirector;
class SearchController extends Controller
{
/**
* @param Request $request
* @return Application|RedirectResponse|Redirector|mixed|void
*/
public function index(Request $request)

View File

@@ -17,9 +17,6 @@ class SettingsController extends Controller
$this->middleware('allowed');
}
/**
* @return View
*/
public function index(): View
{
$settings = SettingGroup::with([
@@ -32,7 +29,6 @@ class SettingsController extends Controller
}
/**
* @param int $id
*
* @return RedirectResponse|View
*/
@@ -59,12 +55,6 @@ class SettingsController extends Controller
}
}
/**
* @param Request $request
* @param int $id
*
* @return RedirectResponse
*/
public function update(Request $request, int $id): RedirectResponse
{
$setting = Setting::find($id);
@@ -114,11 +104,6 @@ class SettingsController extends Controller
}
}
/**
* @param int $id
*
* @return RedirectResponse
*/
public function clear(int $id): RedirectResponse
{
$user = $this->user();

View File

@@ -22,7 +22,7 @@ class TagController extends Controller
*
* @return Application|Factory|View
*/
public function index(Request $request)
public function index(Request $request): \Illuminate\View\View
{
$trash = (bool) $request->input('trash');
@@ -40,7 +40,7 @@ class TagController extends Controller
*
* @return Application|Factory|View
*/
public function create()
public function create(): \Illuminate\View\View
{
$data = [];
@@ -49,9 +49,6 @@ class TagController extends Controller
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return RedirectResponse
*/
public function store(Request $request): RedirectResponse
{
@@ -90,7 +87,6 @@ class TagController extends Controller
* Display the specified resource.
*
* @param $slug
* @return View
*/
public function show($slug): View
{
@@ -105,9 +101,6 @@ class TagController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return View
*/
public function edit(int $id): View
{
@@ -121,10 +114,6 @@ class TagController extends Controller
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return RedirectResponse
*/
public function update(Request $request, int $id): RedirectResponse
{
@@ -156,10 +145,6 @@ class TagController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Request $request
* @param int $id
* @return RedirectResponse
*/
public function destroy(Request $request, int $id): RedirectResponse
{
@@ -181,9 +166,6 @@ class TagController extends Controller
/**
* Restore the specified resource from soft deletion.
*
* @param int $id
* @return RedirectResponse
*/
public function restore(int $id): RedirectResponse
{

View File

@@ -19,8 +19,6 @@ class UserController extends Controller
/**
* Display a listing of the resource.
*
* @return View
*/
public function index(): View
{
@@ -31,8 +29,6 @@ class UserController extends Controller
/**
* Show the form for creating a new resource.
*
* @return View
*/
public function create(): View
{
@@ -41,7 +37,7 @@ class UserController extends Controller
return view('users.create', $data);
}
public function selectUser()
public function selectUser(): \Illuminate\View\View
{
Auth::logout();
$data['users'] = User::all();
@@ -51,9 +47,6 @@ class UserController extends Controller
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return RedirectResponse
*/
public function store(Request $request): RedirectResponse
{
@@ -93,9 +86,6 @@ class UserController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @return void
*/
public function show(int $id): void
{
@@ -104,9 +94,6 @@ class UserController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param User $user
* @return View
*/
public function edit(User $user): View
{
@@ -117,10 +104,6 @@ class UserController extends Controller
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param User $user
* @return RedirectResponse
*/
public function update(Request $request, User $user): RedirectResponse
{
@@ -166,7 +149,6 @@ class UserController extends Controller
/**
* Remove the specified resource from storage.
*
* @param User $user
* @return RedirectResponse | void
*/
public function destroy(User $user): RedirectResponse

View File

@@ -37,19 +37,19 @@ class Kernel extends HttpKernel
],
'api' => [
'throttle:60,1',
\Illuminate\Routing\Middleware\ThrottleRequests::class.':60,1',
'bindings',
],
];
/**
* The application's route middleware.
* The application's middleware aliases.
*
* These middleware may be assigned to groups or used individually.
* Aliases may be used to conveniently assign middleware to routes and groups.
*
* @var array
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'allowed' => \App\Http\Middleware\CheckAllowed::class,
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,

View File

@@ -2,6 +2,7 @@
namespace App\Http\Middleware;
use Symfony\Component\HttpFoundation\Response;
use App\User;
use Closure;
use Illuminate\Auth\AuthenticationException;
@@ -15,12 +16,9 @@ class CheckAllowed
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
* @throws AuthenticationException
*/
public function handle(Request $request, Closure $next)
public function handle(Request $request, Closure $next): Response
{
$route = Route::currentRouteName();
$current_user = User::currentUser();

View File

@@ -2,6 +2,7 @@
namespace App\Http\Middleware;
use Symfony\Component\HttpFoundation\Response;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -10,13 +11,8 @@ class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle(Request $request, Closure $next, string $guard = null)
public function handle(Request $request, Closure $next, string $guard = null): Response
{
if (Auth::guard($guard)->check()) {
return redirect()->intended();

View File

@@ -76,10 +76,7 @@ class Item extends Model
use HasFactory;
/**
* @return void
*/
protected static function boot()
protected static function boot(): void
{
parent::boot();
@@ -113,9 +110,6 @@ class Item extends Model
/**
* Scope a query to only include pinned items.
*
* @param Builder $query
* @return Builder
*/
public function scopePinned(Builder $query): Builder
{
@@ -153,9 +147,6 @@ class Item extends Model
return $tagdetails;
}
/**
* @return string
*/
public function getTagClass(): string
{
$tags = $this->tags();
@@ -170,17 +161,11 @@ class Item extends Model
return implode(' ', $slugs);
}
/**
* @return BelongsToMany
*/
public function parents(): BelongsToMany
{
return $this->belongsToMany(Item::class, 'item_tag', 'item_id', 'tag_id');
}
/**
* @return BelongsToMany
*/
public function children(): BelongsToMany
{
return $this->belongsToMany(Item::class, 'item_tag', 'tag_id', 'item_id');
@@ -198,9 +183,6 @@ class Item extends Model
}
}
/**
* @return string
*/
public function getDroppableAttribute(): string
{
if ((int) $this->type === 1) {
@@ -210,9 +192,6 @@ class Item extends Model
}
}
/**
* @return string
*/
public function getLinkTargetAttribute(): string
{
$target = Setting::fetch('window_target');
@@ -224,9 +203,6 @@ class Item extends Model
}
}
/**
* @return string
*/
public function getLinkIconAttribute(): string
{
if ((int) $this->type === 1) {
@@ -236,9 +212,6 @@ class Item extends Model
}
}
/**
* @return string
*/
public function getLinkTypeAttribute(): string
{
if ((int) $this->type === 1) {
@@ -279,9 +252,6 @@ class Item extends Model
return $query->where('type', $typeid);
}
/**
* @return bool
*/
public function enhanced(): bool
{
/*if(isset($this->class) && !empty($this->class)) {
@@ -295,7 +265,6 @@ class Item extends Model
/**
* @param $class
* @return bool
*/
public static function isEnhanced($class): bool
{
@@ -321,9 +290,6 @@ class Item extends Model
return ((bool) ($app instanceof SearchInterface)) ? $app : false;
}
/**
* @return bool
*/
public function enabled(): bool
{
if ($this->enhanced()) {
@@ -369,7 +335,6 @@ class Item extends Model
/**
* @param $class
* @return Application|null
*/
public static function applicationDetails($class): ?Application
{
@@ -386,7 +351,6 @@ class Item extends Model
/**
* @param $class
* @return string
*/
public static function getApplicationDescription($class): string
{
@@ -400,8 +364,6 @@ class Item extends Model
/**
* Get the user that owns the item.
*
* @return BelongsTo
*/
public function user(): BelongsTo
{

View File

@@ -32,10 +32,9 @@ class ProcessApps implements ShouldQueue, ShouldBeUnique
/**
* Execute the job.
*
* @return void
* @throws GuzzleException
*/
public function handle()
public function handle(): void
{
Log::debug('Process Apps dispatched');
$localapps = Application::whereNull('class')->get();

View File

@@ -30,10 +30,9 @@ class UpdateApps implements ShouldQueue, ShouldBeUnique
/**
* Execute the job.
*
* @return void
* @throws GuzzleException
*/
public function handle()
public function handle(): void
{
Log::debug('Update of all apps triggered!');
$apps = Application::all('appid')->toArray();
@@ -50,10 +49,7 @@ class UpdateApps implements ShouldQueue, ShouldBeUnique
Cache::lock('updateApps')->forceRelease();
}
/**
* @return void
*/
public function failed($exception)
public function failed($exception): void
{
Cache::lock('updateApps')->forceRelease();
}

View File

@@ -19,10 +19,8 @@ class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
public function boot(): void
{
if (! class_exists('ZipArchive')) {
die('You are missing php-zip');
@@ -105,10 +103,8 @@ class AppServiceProvider extends ServiceProvider
/**
* Generate app key if missing and .env exists
*
* @return void
*/
public function genKey()
public function genKey(): void
{
if (is_file(base_path('.env'))) {
if (empty(env('APP_KEY'))) {
@@ -119,10 +115,8 @@ class AppServiceProvider extends ServiceProvider
/**
* Register any application services.
*
* @return void
*/
public function register()
public function register(): void
{
if ($this->app->isLocal()) {
$this->app->register(IdeHelperServiceProvider::class);
@@ -136,7 +130,6 @@ class AppServiceProvider extends ServiceProvider
/**
* Check if database needs an update or do first time database setup
*
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
@@ -158,9 +151,6 @@ class AppServiceProvider extends ServiceProvider
}
}
/**
* @return void
*/
public function createEnvFile(): void
{
if (!is_file(base_path('.env'))) {
@@ -170,9 +160,6 @@ class AppServiceProvider extends ServiceProvider
$this->genKey();
}
/**
* @return bool
*/
private function needsDBUpdate(): bool
{
if (!Schema::hasTable('settings')) {
@@ -185,10 +172,7 @@ class AppServiceProvider extends ServiceProvider
return version_compare($app_version, $db_version) === 1;
}
/**
* @return void
*/
private function updateApps()
private function updateApps(): void
{
// This lock ensures that the job is not invoked multiple times.
// In 5 minutes all app updates should be finished.

View File

@@ -17,13 +17,9 @@ class AuthServiceProvider extends ServiceProvider
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
public function boot(): void
{
$this->registerPolicies();
//
}
}

View File

@@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
public function boot(): void
{
Broadcast::routes();

View File

@@ -19,10 +19,8 @@ class EventServiceProvider extends ServiceProvider
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
public function boot(): void
{
parent::boot();
@@ -31,10 +29,8 @@ class EventServiceProvider extends ServiceProvider
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
public function shouldDiscoverEvents(): bool
{
return false;
}

View File

@@ -17,10 +17,8 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
public function boot(): void
{
//
@@ -29,10 +27,8 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
public function map(): void
{
$this->mapApiRoutes();
@@ -45,10 +41,8 @@ class RouteServiceProvider extends ServiceProvider
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
protected function mapWebRoutes(): void
{
Route::middleware('web')
->group(base_path('routes/web.php'));
@@ -58,10 +52,8 @@ class RouteServiceProvider extends ServiceProvider
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
protected function mapApiRoutes(): void
{
Route::prefix('api')
->middleware('api')

View File

@@ -70,10 +70,6 @@ class Setting extends Model
*/
protected static $cache = [];
/**
* @param Request $request
* @return object
*/
public static function getInput(Request $request): object
{
return (object) [
@@ -198,16 +194,12 @@ class Setting extends Model
return $value;
}
/**
* @return BelongsTo
*/
public function group(): BelongsTo
{
return $this->belongsTo(\App\SettingGroup::class, 'group_id');
}
/**
* @param string $key
*
* @return mixed
*/
@@ -220,11 +212,10 @@ class Setting extends Model
// @codingStandardsIgnoreStart
/**
* @param string $key
*
* @return mixed
*/
public static function _fetch($key, $user = null)
public static function _fetch(string $key, $user = null)
{
// @codingStandardsIgnoreEnd
//$cachekey = ($user === null) ? $key : $key.'-'.$user->id;
@@ -267,20 +258,14 @@ class Setting extends Model
}
/**
* @param string $key
* @param $value
*/
public static function add($key, $value)
public static function add(string $key, $value)
{
self::$cache[$key] = $value;
}
/**
* @param string $key
*
* @return bool
*/
public static function cached($key): bool
public static function cached(string $key): bool
{
return array_key_exists($key, self::$cache);
}

View File

@@ -37,9 +37,6 @@ class SettingGroup extends Model
*/
public $timestamps = false;
/**
* @return HasMany
*/
public function settings(): HasMany
{
return $this->hasMany(\App\Setting::class, 'group_id');

View File

@@ -134,7 +134,7 @@ abstract class SupportedApps
*/
public function getLiveStats($status, $data)
{
$className = get_class($this);
$className = $this::class;
$explode = explode('\\', $className);
$name = end($explode);

View File

@@ -8,22 +8,22 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.0",
"graham-campbell/github": "^10.5",
"php": "^8.1",
"graham-campbell/github": "^12.0",
"guzzlehttp/guzzle": "^7.4",
"laravel/framework": "^9.52",
"laravel/tinker": "^2.7",
"laravel/ui": "^3.3",
"laravelcollective/html": "^6.3",
"laravel/framework": "^10.44",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"laravelcollective/html": "^6.4",
"nunomaduro/collision": "^6.3",
"symfony/yaml": "^6.0",
"symfony/yaml": "^6.2",
"ext-json": "*",
"ext-intl": "*",
"league/flysystem-aws-s3-v3": "^3.0",
"spatie/laravel-ignition": "^1.4"
"spatie/laravel-ignition": "^2.0"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.12",
"barryvdh/laravel-ide-helper": "^2.13",
"filp/whoops": "^2.8",
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "^9.5.10",
@@ -83,5 +83,7 @@
"kylekatarnls/update-helper": true,
"symfony/thanks": true
}
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Facade;
return [
@@ -156,34 +157,7 @@ return [
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
@@ -196,8 +170,7 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
])->toArray(),
/*
|--------------------------------------------------------------------------

View File

@@ -86,16 +86,20 @@ return [
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that each reset token will be
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],

View File

@@ -36,6 +36,7 @@ return [
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),

View File

@@ -52,6 +52,7 @@ return [
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [

View File

@@ -15,7 +15,7 @@ return [
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
@@ -37,9 +37,10 @@ return [
'sqlite' => [
'driver' => 'sqlite',
//'database' => env('DB_DATABASE', database_path('database.sqlite')),
'database' => database_path(env('DB_DATABASE', 'app.sqlite')),
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
@@ -88,8 +89,10 @@ return [
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
@@ -111,7 +114,7 @@ return [
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
@@ -128,7 +131,8 @@ return [
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
@@ -136,7 +140,8 @@ return [
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],

View File

@@ -29,7 +29,8 @@ return [
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
'rounds' => env('BCRYPT_ROUNDS', 12),
'verify' => true,
],
/*
@@ -47,6 +48,7 @@ return [
'memory' => 65536,
'threads' => 1,
'time' => 4,
'verify' => true,
],
];

View File

@@ -3,6 +3,7 @@
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
@@ -61,6 +62,7 @@ return [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
@@ -68,6 +70,7 @@ return [
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
'replace_placeholders' => true,
],
'slack' => [
@@ -76,6 +79,7 @@ return [
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
@@ -87,6 +91,7 @@ return [
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
@@ -97,16 +102,20 @@ return [
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => LOG_USER,
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [

View File

@@ -28,14 +28,15 @@ return [
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
@@ -49,12 +50,19 @@ return [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => null,
// 'client' => [
// 'timeout' => 5,
// ],
],
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'sendmail' => [
@@ -78,6 +86,14 @@ return [
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*

View File

@@ -198,4 +198,17 @@ return [
'same_site' => null,
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => false,
];

View File

@@ -9,8 +9,6 @@ class ItemFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{

View File

@@ -10,8 +10,6 @@ class ItemTagFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{

View File

@@ -2,6 +2,7 @@
namespace Database\Factories;
use Illuminate\Support\Facades\Hash;
use App\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
@@ -13,12 +14,14 @@ class UserFactory extends Factory
*
* @return array
*/
public function definition()
protected static ?string $password;
public function definition(): array
{
return [
'username' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'password' => static::$password ??= Hash::make('password'),
'public_front' => 1,
'remember_token' => Str::random(10),
];
@@ -26,10 +29,8 @@ class UserFactory extends Factory
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
public function unverified(): Factory
{
return $this->state(function (array $attributes) {
return [

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('items', function (Blueprint $table) {
$table->increments('id');
@@ -29,10 +27,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('items');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->increments('id');
@@ -28,10 +26,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('settings');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('setting_groups', function (Blueprint $table) {
$table->increments('id');
@@ -22,10 +20,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('setting_groups');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::table('items', function (Blueprint $table) {
$table->integer('type')->default(0)->index(); // 0 = item, 1 = category
@@ -20,10 +18,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['type']);

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('item_tag', function (Blueprint $table) {
$table->integer('item_id')->unsigned()->index();
@@ -25,10 +23,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('item_tag');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
@@ -28,10 +26,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('users');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
@@ -22,10 +20,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('password_resets');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::table('items', function (Blueprint $table) {
$table->integer('user_id')->default(1)->index(); // 0 = item, 1 = category
@@ -20,10 +18,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['user_id']);

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('setting_user', function (Blueprint $table) {
$table->integer('setting_id')->unsigned()->index();
@@ -25,10 +23,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('setting_user');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('applications', function (Blueprint $table) {
$table->string('appid')->unique();
@@ -30,10 +28,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('applications');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::table('items', function (Blueprint $table) {
$table->string('class')->nullable();
@@ -20,10 +18,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['class']);

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
@@ -26,10 +24,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('jobs');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
@@ -25,10 +23,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::table('items', function (Blueprint $table) {
$table->string('appid')->nullable();
@@ -20,10 +18,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['appid']);

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->string('class')->nullable()->index();
@@ -20,10 +18,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn(['class']);

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::table('items', function (Blueprint $table) {
$table->text('appdescription')->nullable();
@@ -20,10 +18,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::table('items', function (Blueprint $table) {
//

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::rename('password_resets', 'password_reset_tokens');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::rename('password_reset_tokens', 'password_resets');
}
};

View File

@@ -8,10 +8,8 @@ class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
public function run(): void
{
$this->call(SettingsSeeder::class);
$this->call(UsersSeeder::class);

View File

@@ -52,10 +52,8 @@ class SettingsSeeder extends Seeder
/**
* Run the database seeds.
*
* @return void
*/
public function run()
public function run(): void
{
// Groups
if (! $setting_group = SettingGroup::find(1)) {

View File

@@ -9,10 +9,8 @@ class UsersSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
public function run(): void
{
// Groups
if (!User::find(1)) {

View File

@@ -13,113 +13,125 @@ return [
|
*/
'accepted' => 'The :attribute must be accepted.',
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute must only contain letters.',
'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.',
'alpha_num' => 'The :attribute must only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'ascii' => 'The :attribute must only contain single-byte alphanumeric characters and symbols.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'accepted' => 'The :attribute field must be accepted.',
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
'active_url' => 'The :attribute field must be a valid URL.',
'after' => 'The :attribute field must be a date after :date.',
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
'alpha' => 'The :attribute field must only contain letters.',
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
'array' => 'The :attribute field must be an array.',
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
'before' => 'The :attribute field must be a date before :date.',
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
'between' => [
'array' => 'The :attribute must have between :min and :max items.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'numeric' => 'The :attribute must be between :min and :max.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute field must have between :min and :max items.',
'file' => 'The :attribute field must be between :min and :max kilobytes.',
'numeric' => 'The :attribute field must be between :min and :max.',
'string' => 'The :attribute field must be between :min and :max characters.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'can' => 'The :attribute field contains an unauthorized value.',
'confirmed' => 'The :attribute field confirmation does not match.',
'current_password' => 'The password is incorrect.',
'date' => 'The :attribute is not a valid date.',
'date_equals' => 'The :attribute must be a date equal to :date.',
'date_format' => 'The :attribute does not match the format :format.',
'decimal' => 'The :attribute must have :decimal decimal places.',
'declined' => 'The :attribute must be declined.',
'declined_if' => 'The :attribute must be declined when :other is :value.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'date' => 'The :attribute field must be a valid date.',
'date_equals' => 'The :attribute field must be a date equal to :date.',
'date_format' => 'The :attribute field must match the format :format.',
'decimal' => 'The :attribute field must have :decimal decimal places.',
'declined' => 'The :attribute field must be declined.',
'declined_if' => 'The :attribute field must be declined when :other is :value.',
'different' => 'The :attribute field and :other must be different.',
'digits' => 'The :attribute field must be :digits digits.',
'digits_between' => 'The :attribute field must be between :min and :max digits.',
'dimensions' => 'The :attribute field has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.',
'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.',
'email' => 'The :attribute must be a valid email address.',
'ends_with' => 'The :attribute must end with one of the following: :values.',
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
'email' => 'The :attribute field must be a valid email address.',
'ends_with' => 'The :attribute field must end with one of the following: :values.',
'enum' => 'The selected :attribute is invalid.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'extensions' => 'The :attribute field must have one of the following extensions: :values.',
'file' => 'The :attribute field must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'array' => 'The :attribute must have more than :value items.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'numeric' => 'The :attribute must be greater than :value.',
'string' => 'The :attribute must be greater than :value characters.',
'array' => 'The :attribute field must have more than :value items.',
'file' => 'The :attribute field must be greater than :value kilobytes.',
'numeric' => 'The :attribute field must be greater than :value.',
'string' => 'The :attribute field must be greater than :value characters.',
],
'gte' => [
'array' => 'The :attribute must have :value items or more.',
'file' => 'The :attribute must be greater than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be greater than or equal to :value.',
'string' => 'The :attribute must be greater than or equal to :value characters.',
'array' => 'The :attribute field must have :value items or more.',
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
'numeric' => 'The :attribute field must be greater than or equal to :value.',
'string' => 'The :attribute field must be greater than or equal to :value characters.',
],
'image' => 'The :attribute must be an image.',
'hex_color' => 'The :attribute field must be a valid hexadecimal color.',
'image' => 'The :attribute field must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lowercase' => 'The :attribute must be lowercase.',
'in_array' => 'The :attribute field must exist in :other.',
'integer' => 'The :attribute field must be an integer.',
'ip' => 'The :attribute field must be a valid IP address.',
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
'json' => 'The :attribute field must be a valid JSON string.',
'lowercase' => 'The :attribute field must be lowercase.',
'lt' => [
'array' => 'The :attribute must have less than :value items.',
'file' => 'The :attribute must be less than :value kilobytes.',
'numeric' => 'The :attribute must be less than :value.',
'string' => 'The :attribute must be less than :value characters.',
'array' => 'The :attribute field must have less than :value items.',
'file' => 'The :attribute field must be less than :value kilobytes.',
'numeric' => 'The :attribute field must be less than :value.',
'string' => 'The :attribute field must be less than :value characters.',
],
'lte' => [
'array' => 'The :attribute must not have more than :value items.',
'file' => 'The :attribute must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be less than or equal to :value.',
'string' => 'The :attribute must be less than or equal to :value characters.',
'array' => 'The :attribute field must not have more than :value items.',
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute field must be less than or equal to :value.',
'string' => 'The :attribute field must be less than or equal to :value characters.',
],
'mac_address' => 'The :attribute must be a valid MAC address.',
'mac_address' => 'The :attribute field must be a valid MAC address.',
'max' => [
'array' => 'The :attribute must not have more than :max items.',
'file' => 'The :attribute must not be greater than :max kilobytes.',
'numeric' => 'The :attribute must not be greater than :max.',
'string' => 'The :attribute must not be greater than :max characters.',
'array' => 'The :attribute field must not have more than :max items.',
'file' => 'The :attribute field must not be greater than :max kilobytes.',
'numeric' => 'The :attribute field must not be greater than :max.',
'string' => 'The :attribute field must not be greater than :max characters.',
],
'max_digits' => 'The :attribute must not have more than :max digits.',
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'max_digits' => 'The :attribute field must not have more than :max digits.',
'mimes' => 'The :attribute field must be a file of type: :values.',
'mimetypes' => 'The :attribute field must be a file of type: :values.',
'min' => [
'array' => 'The :attribute must have at least :min items.',
'file' => 'The :attribute must be at least :min kilobytes.',
'numeric' => 'The :attribute must be at least :min.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute field must have at least :min items.',
'file' => 'The :attribute field must be at least :min kilobytes.',
'numeric' => 'The :attribute field must be at least :min.',
'string' => 'The :attribute field must be at least :min characters.',
],
'min_digits' => 'The :attribute must have at least :min digits.',
'multiple_of' => 'The :attribute must be a multiple of :value.',
'min_digits' => 'The :attribute field must have at least :min digits.',
'missing' => 'The :attribute field must be missing.',
'missing_if' => 'The :attribute field must be missing when :other is :value.',
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
'missing_with' => 'The :attribute field must be missing when :values is present.',
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
'multiple_of' => 'The :attribute field must be a multiple of :value.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'not_regex' => 'The :attribute field format is invalid.',
'numeric' => 'The :attribute field must be a number.',
'password' => [
'letters' => 'The :attribute must contain at least one letter.',
'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.',
'numbers' => 'The :attribute must contain at least one number.',
'symbols' => 'The :attribute must contain at least one symbol.',
'letters' => 'The :attribute field must contain at least one letter.',
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
'numbers' => 'The :attribute field must contain at least one number.',
'symbols' => 'The :attribute field must contain at least one symbol.',
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
],
'present' => 'The :attribute field must be present.',
'present_if' => 'The :attribute field must be present when :other is :value.',
'present_unless' => 'The :attribute field must be present unless :other is :value.',
'present_with' => 'The :attribute field must be present when :values is present.',
'present_with_all' => 'The :attribute field must be present when :values are present.',
'prohibited' => 'The :attribute field is prohibited.',
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
'prohibits' => 'The :attribute field prohibits :other from being present.',
'regex' => 'The :attribute format is invalid.',
'regex' => 'The :attribute field format is invalid.',
'required' => 'The :attribute field is required.',
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
'required_if' => 'The :attribute field is required when :other is :value.',
@@ -129,22 +141,22 @@ return [
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'same' => 'The :attribute field must match :other.',
'size' => [
'array' => 'The :attribute must contain :size items.',
'file' => 'The :attribute must be :size kilobytes.',
'numeric' => 'The :attribute must be :size.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute field must contain :size items.',
'file' => 'The :attribute field must be :size kilobytes.',
'numeric' => 'The :attribute field must be :size.',
'string' => 'The :attribute field must be :size characters.',
],
'starts_with' => 'The :attribute must start with one of the following: :values.',
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid timezone.',
'starts_with' => 'The :attribute field must start with one of the following: :values.',
'string' => 'The :attribute field must be a string.',
'timezone' => 'The :attribute field must be a valid timezone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'uppercase' => 'The :attribute must be uppercase.',
'url' => 'The :attribute must be a valid URL.',
'ulid' => 'The :attribute must be a valid ULID.',
'uuid' => 'The :attribute must be a valid UUID.',
'uppercase' => 'The :attribute field must be uppercase.',
'url' => 'The :attribute field must be a valid URL.',
'ulid' => 'The :attribute field must be a valid ULID.',
'uuid' => 'The :attribute field must be a valid UUID.',
/*
|--------------------------------------------------------------------------

View File

@@ -20,7 +20,8 @@
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>

View File

@@ -2,16 +2,15 @@
namespace Tests;
use Illuminate\Foundation\Application;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
public function createApplication(): Application
{
$app = require __DIR__.'/../bootstrap/app.php';

View File

@@ -42,7 +42,7 @@ class DashTest extends TestCase
* Test Cases
*/
public function test_loads_empty_dash()
public function test_loads_empty_dash(): void
{
$this->seed();
@@ -51,7 +51,7 @@ class DashTest extends TestCase
$response->assertStatus(200);
}
public function test_displays_items_on_the_dash()
public function test_displays_items_on_the_dash(): void
{
$this->seed();
@@ -67,7 +67,7 @@ class DashTest extends TestCase
$response->assertSee('Item 3');
}
public function test_displays_tags_on_the_dash()
public function test_displays_tags_on_the_dash(): void
{
$this->seed();

View File

@@ -9,7 +9,7 @@ class ItemCreateTest extends TestCase
{
use RefreshDatabase;
public function test_displays_the_item_create_page()
public function test_displays_the_item_create_page(): void
{
$this->seed();
@@ -18,7 +18,7 @@ class ItemCreateTest extends TestCase
$response->assertStatus(200);
}
public function test_display_the_home_dashboard_tag()
public function test_display_the_home_dashboard_tag(): void
{
$this->seed();
@@ -27,7 +27,7 @@ class ItemCreateTest extends TestCase
$response->assertSee('Home dashboard');
}
public function test_creates_a_new_item()
public function test_creates_a_new_item(): void
{
$this->seed();
$item = [
@@ -46,7 +46,7 @@ class ItemCreateTest extends TestCase
$response->assertSee('Redirecting to');
}
public function test_redirects_to_dash_when_adding_a_new_item()
public function test_redirects_to_dash_when_adding_a_new_item(): void
{
$this->seed();
$item = [

View File

@@ -10,7 +10,7 @@ class ItemDeleteTest extends TestCase
{
use RefreshDatabase;
public function test_deletes_an_item()
public function test_deletes_an_item(): void
{
$this->seed();
$item = Item::factory()
@@ -23,7 +23,7 @@ class ItemDeleteTest extends TestCase
$response->assertStatus(302);
}
public function test_redirects_to_item_list_page_when_deleting_an_item()
public function test_redirects_to_item_list_page_when_deleting_an_item(): void
{
$this->seed();
$item = Item::factory()

View File

@@ -12,14 +12,14 @@ class ItemExportTest extends TestCase
use RefreshDatabase;
public function test_returns_empty_jsonarray_when_there_are_no_items_in_the_db()
public function test_returns_empty_jsonarray_when_there_are_no_items_in_the_db(): void
{
$response = $this->get('api/item');
$response->assertJsonCount(0);
}
public function test_returns_exactly_the_defined_fields()
public function test_returns_exactly_the_defined_fields(): void
{
$exampleItem = [
"appdescription" => "Description",
@@ -37,7 +37,7 @@ class ItemExportTest extends TestCase
$response->assertExactJson([(object)$exampleItem]);
}
public function test_returns_all_items()
public function test_returns_all_items(): void
{
Item::factory()
->count(3)
@@ -48,7 +48,7 @@ class ItemExportTest extends TestCase
$response->assertJsonCount(3);
}
public function test_does_not_return_deleted_item()
public function test_does_not_return_deleted_item(): void
{
Item::factory()
->create([
@@ -62,7 +62,7 @@ class ItemExportTest extends TestCase
$response->assertJsonCount(1);
}
public function test_does_not_return_tags()
public function test_does_not_return_tags(): void
{
Item::factory()
->create([

View File

@@ -18,7 +18,7 @@ class ItemListTest extends TestCase
]);
}
public function test_displays_items_on_the_item_list_page()
public function test_displays_items_on_the_item_list_page(): void
{
$this->addItemWithTitleToDB('Item 1');
$this->addItemWithTitleToDB('Item 2');
@@ -32,7 +32,7 @@ class ItemListTest extends TestCase
$response->assertSee('Item 3');
}
public function test_escapes_xss_on_the_item_list_page()
public function test_escapes_xss_on_the_item_list_page(): void
{
$this->addItemWithTitleToDB('<script>alert("XSS")</script>');

View File

@@ -9,7 +9,7 @@ class SettingsTest extends TestCase
{
use RefreshDatabase;
public function test_displays_the_settings_page()
public function test_displays_the_settings_page(): void
{
$this->seed();

View File

@@ -19,7 +19,7 @@ class TagListTest extends TestCase
]);
}
public function test_displays_the_tags_on_the_tag_list_page()
public function test_displays_the_tags_on_the_tag_list_page(): void
{
$this->addTagWithTitleToDB('Tag 1');
$this->addTagWithTitleToDB('Tag 2');
@@ -33,7 +33,7 @@ class TagListTest extends TestCase
$response->assertSee('Tag 3');
}
public function test_escapes_xss_on_the_tag_list_page()
public function test_escapes_xss_on_the_tag_list_page(): void
{
$this->addTagWithTitleToDB('<script>alert("XSS")</script>');

View File

@@ -18,7 +18,7 @@ class UserListTest extends TestCase
]);
}
public function test_displays_admin_on_user_list_page_when_default_install()
public function test_displays_admin_on_user_list_page_when_default_install(): void
{
$this->seed();
@@ -28,7 +28,7 @@ class UserListTest extends TestCase
$response->assertSee('admin');
}
public function test_displays_users_on_user_list_page()
public function test_displays_users_on_user_list_page(): void
{
$this->seed();

View File

@@ -9,10 +9,8 @@ class SettingsSeederTest extends TestCase
{
/**
* All language keys are defined in all languages based on the en language file.
*
* @return void
*/
public function test_returns_a_jsonmap_with_same_amount_of_items_as_language_directories_present()
public function test_returns_a_jsonmap_with_same_amount_of_items_as_language_directories_present(): void
{
$languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir');

View File

@@ -6,10 +6,7 @@ use Tests\TestCase;
class IsImageTest extends TestCase
{
/**
* @return void
*/
public function test_returns_true_when_file_is_image()
public function test_returns_true_when_file_is_image(): void
{
$file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png');
@@ -18,20 +15,14 @@ class IsImageTest extends TestCase
$this->assertTrue($actual);
}
/**
* @return void
*/
public function test_returns_false_when_file_extension_is_image_but_content_is_not()
public function test_returns_false_when_file_extension_is_image_but_content_is_not(): void
{
$actual = isImage("<?php ?>", "png");
$this->assertFalse($actual);
}
/**
* @return void
*/
public function test_returns_false_when_file_extension_is_not_image_but_content_is()
public function test_returns_false_when_file_extension_is_not_image_but_content_is(): void
{
$file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png');

View File

@@ -6,10 +6,7 @@ use Tests\TestCase;
class SlugTest extends TestCase
{
/**
* @return void
*/
public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US()
public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US(): void
{
$tag = str_slug('中文測試', '-', 'en_US');

View File

@@ -8,10 +8,8 @@ class LangTest extends TestCase
{
/**
* All language keys are defined in all languages based on the en language file.
*
* @return void
*/
public function test_all_language_keys_are_defined()
public function test_all_language_keys_are_defined(): void
{
$this->markTestSkipped('2022-11-14 Lot of keys missing. Enable this test to see them all.');
$languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir');