Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move models to app/Models #1298

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .phpstorm.meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -418,7 +418,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -626,7 +626,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -834,7 +834,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -1042,7 +1042,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -1250,7 +1250,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -1458,7 +1458,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -1666,7 +1666,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -1874,7 +1874,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -2082,7 +2082,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down Expand Up @@ -2290,7 +2290,7 @@
'router' => \Illuminate\Routing\Router::class,
'session' => \Illuminate\Session\SessionManager::class,
'session.store' => \Illuminate\Session\Store::class,
'settings' => \App\Setting::class,
'settings' => \App\Models\Setting::class,
'translation.loader' => \Illuminate\Translation\FileLoader::class,
'translator' => \Illuminate\Translation\Translator::class,
'url' => \Illuminate\Routing\UrlGenerator::class,
Expand Down
14 changes: 7 additions & 7 deletions _ide_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@
/**
* Get the currently authenticated user.
*
* @return \App\User|null
* @return \App\Models\User|null
* @static
*/ public static function user()
{
Expand Down Expand Up @@ -1855,7 +1855,7 @@
* Log the given user ID into the application without sessions or cookies.
*
* @param mixed $id
* @return \App\User|false
* @return \App\Models\User|false
* @static
*/ public static function onceUsingId($id)
{
Expand Down Expand Up @@ -1929,7 +1929,7 @@
*
* @param mixed $id
* @param bool $remember
* @return \App\User|false
* @return \App\Models\User|false
* @static
*/ public static function loginUsingId($id, $remember = false)
{
Expand Down Expand Up @@ -1977,7 +1977,7 @@
*
* @param string $password
* @param string $attribute
* @return \App\User|null
* @return \App\Models\User|null
* @throws \Illuminate\Auth\AuthenticationException
* @static
*/ public static function logoutOtherDevices($password, $attribute = 'password')
Expand All @@ -1999,7 +1999,7 @@
/**
* Get the last user we attempted to authenticate.
*
* @return \App\User
* @return \App\Models\User
* @static
*/ public static function getLastAttempted()
{
Expand Down Expand Up @@ -2103,7 +2103,7 @@
/**
* Return the currently cached user.
*
* @return \App\User|null
* @return \App\Models\User|null
* @static
*/ public static function getUser()
{
Expand Down Expand Up @@ -2155,7 +2155,7 @@
/**
* Determine if the current user is authenticated. If not, throw an exception.
*
* @return \App\User
* @return \App\Models\User
* @throws \Illuminate\Auth\AuthenticationException
* @static
*/ public static function authenticate()
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/RegisterApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Console\Commands;

use App\Application;
use App\Models\Application;
use App\SupportedApps;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
Expand Down
2 changes: 1 addition & 1 deletion app/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function title_color($hex): string
*/
function getLinkTargetAttribute(): string
{
$target = \App\Setting::fetch('window_target');
$target = \App\Models\Setting::fetch('window_target');

if ($target === 'current') {
return '';
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\User;
use App\Models\User;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Controllers;

use App\User;
use App\Models\User;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/HealthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Controllers;

use App\Item;
use App\User;
use App\Models\Item;
use App\Models\User;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers;

use App\Application;
use App\Item;
use App\Jobs\ProcessApps;
use App\User;
use App\Models\Application;
use App\Models\Item;
use App\Models\User;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\GuzzleException;
Expand Down Expand Up @@ -35,7 +35,7 @@ public function __construct()
*/
public function dash(): View
{
$treat_tags_as = \App\Setting::fetch('treat_tags_as');
$treat_tags_as = \App\Models\Setting::fetch('treat_tags_as');

$data["treat_tags_as"] = $treat_tags_as;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ItemRestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Controllers;

use App\Item;
use App\Models\Item;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Collection;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Controllers;

use App\Setting;
use App\SettingGroup;
use App\Models\Setting;
use App\Models\SettingGroup;
use Exception;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Controllers;

use App\Item;
use App\User;
use App\Models\Item;
use App\Models\User;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Controllers;

use App\User;
use App\Models\User;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
Expand Down
5 changes: 2 additions & 3 deletions app/Http/Middleware/CheckAllowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace App\Http\Middleware;

use Symfony\Component\HttpFoundation\Response;
use App\User;
use App\Models\User;
use Closure;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Session;
use Symfony\Component\HttpFoundation\Response;

class CheckAllowed
{
Expand Down
4 changes: 2 additions & 2 deletions app/Jobs/ProcessApps.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Jobs;

use App\Application;
use App\Item;
use App\Models\Application;
use App\Models\Item;
use App\SupportedApps;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Bus\Queueable;
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/UpdateApps.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Jobs;

use App\Application;
use App\Models\Application;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
Expand Down
10 changes: 6 additions & 4 deletions app/Application.php → app/Models/Application.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace App;
namespace App\Models;

use App\SupportedApps;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
Expand Down Expand Up @@ -38,6 +39,7 @@
* @method static Builder|Application whereTileBackground($value)
* @method static Builder|Application whereUpdatedAt($value)
* @method static Builder|Application whereWebsite($value)
* @mixin \Eloquent
*/
class Application extends Model
{
Expand Down Expand Up @@ -86,7 +88,7 @@ public function class(): string
$name = $this->name;
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);

return \App\SupportedApps::class.'\\'.$name.'\\'.$name;
return SupportedApps::class.'\\'.$name.'\\'.$name;
}

/**
Expand All @@ -96,7 +98,7 @@ public static function classFromName($name): string
{
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);

$class = \App\SupportedApps::class.'\\'.$name.'\\'.$name;
$class = SupportedApps::class.'\\'.$name.'\\'.$name;

return $class;
}
Expand Down Expand Up @@ -172,7 +174,7 @@ public static function single($appid)
return null;
}
$classname = preg_replace('/[^\p{L}\p{N}]/u', '', $app->name);
$app->class = \App\SupportedApps::class.'\\'.$classname.'\\'.$classname;
$app->class = SupportedApps::class.'\\'.$classname.'\\'.$classname;

return $app;
}
Expand Down
9 changes: 6 additions & 3 deletions app/Item.php → app/Models/Item.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php

namespace App;
namespace App\Models;

use App\EnhancedApps;
use App\SearchInterface;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Casts\Attribute;
use stdClass;
use Symfony\Component\ClassLoader\ClassMapGenerator;

Expand Down Expand Up @@ -42,7 +44,7 @@
* @property-read string $link_type
* @property-read \Illuminate\Database\Eloquent\Collection|Item[] $parents
* @property-read int|null $parents_count
* @property-read \App\User|null $user
* @property-read \App\Models\User|null $user
* @method static \Database\Factories\ItemFactory factory(...$parameters)
* @method static Builder|Item newModelQuery()
* @method static Builder|Item newQuery()
Expand All @@ -68,6 +70,7 @@
* @method static Builder|Item whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|Item withTrashed()
* @method static \Illuminate\Database\Query\Builder|Item withoutTrashed()
* @property-read mixed $tag_url
* @mixin \Eloquent
*/
// @codingStandardsIgnoreEnd
Expand Down
Loading
Loading