diff --git a/Blacklight/Books.php b/Blacklight/Books.php index f723578e7..abc579dde 100755 --- a/Blacklight/Books.php +++ b/Blacklight/Books.php @@ -2,6 +2,7 @@ namespace Blacklight; +use Illuminate\Database\Eloquent\Model; use App\Models\BookInfo; use App\Models\Category; use App\Models\Release; @@ -92,10 +93,7 @@ class Books return BookInfo::query()->where('id', $id)->first(); } - /** - * @return \Illuminate\Database\Eloquent\Model - */ - public function getBookInfoByName($title) + public function getBookInfoByName($title): Model { //only used to get a count of words $searchWords = ''; @@ -276,7 +274,7 @@ class Books Release::query()->where('nzbstatus', '=', NZB::NZB_ADDED) ->whereNull('bookinfo_id') ->whereIn('categories_id', [$iValue]) - ->orderBy('postdate', 'desc') + ->orderByDesc('postdate') ->limit($this->bookqty) ->get(['searchname', 'id', 'categories_id']), $iValue ); diff --git a/Blacklight/Console.php b/Blacklight/Console.php index 9aa7ed30c..b7eb4340e 100755 --- a/Blacklight/Console.php +++ b/Blacklight/Console.php @@ -121,11 +121,9 @@ class Console } /** - * @param string $title - * @param string $platform * @return false|\Illuminate\Database\Eloquent\Model */ - public function getConsoleInfoByName($title, $platform) + public function getConsoleInfoByName(string $title, string $platform) { //only used to get a count of words $searchWords = ''; @@ -297,10 +295,7 @@ class Console return $browseBy; } - /** - * @param string $review - */ - public function update($id, $title, $asin, $url, $salesrank, $platform, $publisher, $releasedate, $esrb, $cover, $genres_id, $review = 'review'): void + public function update($id, $title, $asin, $url, $salesrank, $platform, $publisher, $releasedate, $esrb, $cover, $genres_id, string $review = 'review'): void { $releasedate = $releasedate !== '' ? $releasedate : 'null'; $review = $review === 'review' ? $review : substr($review, 0, 3000); @@ -512,10 +507,8 @@ class Console /** * This function sets the platform retrieved * from the release to the Amazon equivalent. - * - * @param string $platform */ - protected function _replacePlatform($platform): string + protected function _replacePlatform(string $platform): string { switch (strtoupper($platform)) { case 'X360': diff --git a/Blacklight/Genres.php b/Blacklight/Genres.php index d4f0b8bcf..67b94edc3 100755 --- a/Blacklight/Genres.php +++ b/Blacklight/Genres.php @@ -37,11 +37,9 @@ class Genres } /** - * @param string $type - * @param bool $activeOnly * @return array|mixed */ - public function getGenres($type = '', $activeOnly = false) + public function getGenres(string $type = '', bool $activeOnly = false) { $sql = $this->getListQuery($type, $activeOnly); $genres = Cache::get(md5($sql)); @@ -66,11 +64,7 @@ class Genres return $genresArray; } - /** - * @param string $type - * @param bool $activeOnly - */ - private function getListQuery($type = '', $activeOnly = false): string + private function getListQuery(string $type = '', bool $activeOnly = false): string { if (! empty($type)) { $typesql = sprintf(' AND g.type = %d', $type); diff --git a/Blacklight/IRCClient.php b/Blacklight/IRCClient.php index 1bc319f33..3e7e36230 100755 --- a/Blacklight/IRCClient.php +++ b/Blacklight/IRCClient.php @@ -188,7 +188,7 @@ class IRCClient * * @param int $timeout Seconds. */ - public function setSocketTimeout($timeout) + public function setSocketTimeout(int $timeout) { if (! is_numeric($timeout)) { echo 'ERROR: IRC socket timeout must be a number!'.PHP_EOL; @@ -202,7 +202,7 @@ class IRCClient * * @param int $timeout Seconds. */ - public function setConnectionTimeout($timeout) + public function setConnectionTimeout(int $timeout) { if (! is_numeric($timeout)) { echo 'ERROR: IRC connection timeout must be a number!'.PHP_EOL; @@ -213,10 +213,8 @@ class IRCClient /** * Amount of times to retry before giving up when connecting. - * - * @param int $retries */ - public function setConnectionRetries($retries) + public function setConnectionRetries(int $retries) { if (! is_numeric($retries)) { echo 'ERROR: IRC connection retries must be a number!'.PHP_EOL; @@ -230,7 +228,7 @@ class IRCClient * * @param int $delay Seconds. */ - public function setReConnectDelay($delay) + public function setReConnectDelay(int $delay) { if (! is_numeric($delay)) { echo 'ERROR: IRC reconnect delay must be a number!'.PHP_EOL; @@ -245,9 +243,8 @@ class IRCClient * @param string $hostname Host name of the IRC server (can be a IP or a name). * @param int $port Port number of the IRC server. * @param bool $tls Use encryption for the socket transport? (make sure the port is right). - * @return bool */ - public function connect($hostname, $port = 6667, $tls = false) + public function connect(string $hostname, int $port = 6667, bool $tls = false): bool { $this->_alreadyLoggedIn = false; $transport = ($tls === true ? 'tls' : 'tcp'); @@ -301,9 +298,8 @@ class IRCClient * @param string $userName The user name - visible in the host name. * @param string $realName The real name - visible in the WhoIs. * @param null $password The password - some servers require a password. - * @return bool */ - public function login($nickName, $userName, $realName, $password = null) + public function login(string $nickName, string $userName, string $realName, $password = null): bool { if (! $this->_connected()) { echo 'ERROR: You must connect to IRC first!'.PHP_EOL; @@ -384,9 +380,8 @@ class IRCClient * Quit from IRC. * * @param string $message Optional disconnect message. - * @return bool */ - public function quit($message = null) + public function quit(string $message = null): bool { if ($this->_connected()) { $this->_writeSocket('QUIT'.($message === null ? '' : ' :'.$message)); @@ -439,9 +434,8 @@ class IRCClient * * @param array $channels Array of channels with their passwords (null if the channel doesn't need a password). * array( '#exampleChannel' => 'thePassword', '#exampleChan2' => null ); - * @return bool */ - public function joinChannels($channels = []) + public function joinChannels(array $channels = []): bool { $this->_channels = $channels; @@ -470,21 +464,16 @@ class IRCClient /** * Join a channel. - * - * @param string $channel - * @param string $password */ - protected function _joinChannel($channel, $password) + protected function _joinChannel(string $channel, string $password) { $this->_writeSocket('JOIN '.$channel.(empty($password) ? '' : ' '.$password)); } /** * Send PONG to a host. - * - * @param string $host */ - protected function _pong($host) + protected function _pong(string $host) { if ($this->_writeSocket('PONG '.$host) === false) { $this->_reconnect(); @@ -498,10 +487,8 @@ class IRCClient /** * Send PING to a host. - * - * @param string $host */ - protected function _ping($host) + protected function _ping(string $host) { $pong = $this->_writeSocket('PING '.$host); @@ -553,11 +540,8 @@ class IRCClient /** * Send a command to the IRC server. - * - * @param string $command - * @return bool */ - protected function _writeSocket($command) + protected function _writeSocket(string $command): bool { $command .= "\r\n"; for ($written = 0, $writtenMax = \strlen($command); $written < $writtenMax; $written += $fWrite) { @@ -629,21 +613,16 @@ class IRCClient /** * Check if we are connected to the IRC server. - * - * @return bool */ - protected function _connected() + protected function _connected(): bool { return \is_resource($this->_socket) && ! feof($this->_socket); } /** * Strips control characters from a IRC message. - * - * @param string $text - * @return string */ - protected function _stripControlCharacters($text) + protected function _stripControlCharacters(string $text): string { return preg_replace( [ diff --git a/Blacklight/IRCScraper.php b/Blacklight/IRCScraper.php index 87533ebf7..221484bcd 100755 --- a/Blacklight/IRCScraper.php +++ b/Blacklight/IRCScraper.php @@ -403,10 +403,8 @@ class IRCScraper extends IRCClient /** * Echo new or update pre to CLI. - * - * @param bool $new */ - protected function _doEcho($new = true) + protected function _doEcho(bool $new = true) { if (! $this->_silent) { $nukeString = ''; @@ -460,10 +458,9 @@ class IRCScraper extends IRCClient /** * Get a group id for a group name. * - * @param string $groupName * @return mixed */ - protected function _getGroupID($groupName) + protected function _getGroupID(string $groupName) { if (! isset($this->_groupList[$groupName])) { $group = UsenetGroup::query()->where('name', $groupName)->first(['id']); diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php index 69d9106e0..986988c10 100755 --- a/Blacklight/Movie.php +++ b/Blacklight/Movie.php @@ -213,10 +213,9 @@ class Movie * Get movie releases with covers for movie browse page. * * - * @param int $maxAge * @return array|mixed */ - public function getMovieRange($page, $cat, $start, $num, $orderBy, $maxAge = -1, array $excludedCats = []) + public function getMovieRange($page, $cat, $start, $num, $orderBy, int $maxAge = -1, array $excludedCats = []) { $catsrch = ''; if (\count($cat) > 0 && $cat[0] !== -1) { @@ -376,12 +375,11 @@ class Movie /** * Get trailer using IMDB Id. * - * @param int $imdbId * @return bool|string * * @throws \Exception */ - public function getTrailer($imdbId) + public function getTrailer(int $imdbId) { $trailer = MovieInfo::query()->where('imdbid', $imdbId)->where('trailer', '<>', '')->first(['trailer']); if ($trailer !== null) { @@ -408,10 +406,9 @@ class Movie /** * Parse trakt info, insert into DB. * - * @param array $data * @return mixed */ - public function parseTraktTv(&$data) + public function parseTraktTv(array &$data) { if (empty($data['ids']['imdb'])) { return false; @@ -514,14 +511,9 @@ class Movie /** * Returns a tmdb, imdb or trakt variable, the one that is set. Empty string if both not set. * - * @param string $variable1 - * @param string $variable2 - * @param string $variable3 - * @param string $variable4 - * @param string $variable5 * @return array|string */ - protected function setVariables($variable1, $variable2, $variable3, $variable4, $variable5) + protected function setVariables(string $variable1, string $variable2, string $variable3, string $variable4, string $variable5) { if (! empty($variable1)) { return $variable1; @@ -741,10 +733,9 @@ class Movie * Fetch info for IMDB id from TMDB. * * - * @param bool $text * @return array|false */ - public function fetchTMDBProperties($imdbId, $text = false) + public function fetchTMDBProperties($imdbId, bool $text = false) { $lookupId = $text === false && (\strlen($imdbId) === 7 || strlen($imdbId) === 8) ? 'tt'.$imdbId : $imdbId; @@ -999,13 +990,12 @@ class Movie } /** - * @param string $title * @return array|bool * * @throws \DariusIII\ItunesApi\Exceptions\InvalidProviderException * @throws \Exception */ - public function fetchItunesMovieProperties($title) + public function fetchItunesMovieProperties(string $title) { $movie = true; try { @@ -1046,7 +1036,7 @@ class Movie * * @throws \Exception */ - public function doMovieUpdate($buffer, $service, $id, $processImdb = 1): string + public function doMovieUpdate(string $buffer, string $service, int $id, int $processImdb = 1): string { $imdbId = false; if (\is_string($buffer) && preg_match('/(?:imdb.*?)?(?:tt|Title\?)(?P\d{5,8})/i', $buffer, $hits)) { @@ -1086,13 +1076,10 @@ class Movie * Process releases with no IMDB id's. * * - * @param string $groupID - * @param string $guidChar - * @param int $lookupIMDB * * @throws \Exception */ - public function processMovieReleases($groupID = '', $guidChar = '', $lookupIMDB = 1): void + public function processMovieReleases(string $groupID = '', string $guidChar = '', int $lookupIMDB = 1): void { if ($lookupIMDB === 0) { return; @@ -1277,10 +1264,8 @@ class Movie /** * Parse a movie name from a release search name. - * - * @param string $releaseName */ - protected function parseMovieSearchName($releaseName): bool + protected function parseMovieSearchName(string $releaseName): bool { $name = $year = ''; $followingList = '[^\w]((1080|480|720)p|AC3D|Directors([^\w]CUT)?|DD5\.1|(DVD|BD|BR)(Rip)?|BluRay|divx|HDTV|iNTERNAL|LiMiTED|(Real\.)?Proper|RE(pack|Rip)|Sub\.?(fix|pack)|Unrated|WEB-DL|(x|H)[ ._-]?264|xvid)[^\w]'; diff --git a/Blacklight/Music.php b/Blacklight/Music.php index 25c127a3d..063a60cc6 100755 --- a/Blacklight/Music.php +++ b/Blacklight/Music.php @@ -401,11 +401,10 @@ class Music } /** - * @param bool $local * * @throws \Exception */ - public function processMusicReleases($local = false) + public function processMusicReleases(bool $local = false) { $res = DB::select( sprintf( @@ -481,10 +480,9 @@ class Music } /** - * @param string $releaseName * @return array|false */ - public function parseArtist($releaseName) + public function parseArtist(string $releaseName) { if (preg_match('/(.+?)(\d{1,2} \d{1,2} )?\(?(19\d{2}|20[0-1][\d])\b/', $releaseName, $name)) { $result = []; @@ -618,13 +616,12 @@ class Music } /** - * @param string $title * @return array|bool * * @throws \DariusIII\ItunesApi\Exceptions\InvalidProviderException * @throws \Exception */ - protected function fetchItunesMusicProperties($title) + protected function fetchItunesMusicProperties(string $title) { $mus = true; // Load genres. diff --git a/Blacklight/NNTP.php b/Blacklight/NNTP.php index 7aa6a6c36..bdd07d8fb 100755 --- a/Blacklight/NNTP.php +++ b/Blacklight/NNTP.php @@ -356,7 +356,7 @@ class NNTP extends \Net_NNTP_Client * @throws \Exception * On failure : (object) PEAR_Error. */ - public function selectGroup($group, $articles = false, bool $force = false): mixed + public function selectGroup(string $group, bool $articles = false, bool $force = false): mixed { $connected = $this->_checkConnection(false); if ($connected !== true) { @@ -376,15 +376,12 @@ class NNTP extends \Net_NNTP_Client /** * Fetch an overview of article(s) in the currently selected group. * - * @param string $range - * @param bool $names - * @param bool $forceNames * @return mixed On success : (array) Multidimensional array with article headers. * * @throws \Exception * On failure : (object) PEAR_Error. */ - public function getOverview($range = null, $names = true, $forceNames = true): mixed + public function getOverview(string $range = null, bool $names = true, bool $forceNames = true): mixed { $connected = $this->_checkConnection(); if ($connected !== true) { @@ -507,7 +504,7 @@ class NNTP extends \Net_NNTP_Client * * @throws \Exception */ - public function getGroups($wildMat = null) + public function getGroups(string $wildMat = null) { // Enabled header compression if not enabled. $this->_enableCompression(); @@ -1300,7 +1297,7 @@ class NNTP extends \Net_NNTP_Client * @return mixed (bool) On success: True when posting allowed, otherwise false. * (object) On failure: pear_error */ - public function connect($host = null, $encryption = null, $port = null, $timeout = 15, int $socketTimeout = 120): mixed + public function connect(string $host = null, $encryption = null, int $port = null, int $timeout = 15, int $socketTimeout = 120): mixed { if ($this->_isConnected()) { return $this->throwError('Already connected, disconnect first!', null); diff --git a/Blacklight/NZBContents.php b/Blacklight/NZBContents.php index 243cf23ad..e8567c26e 100755 --- a/Blacklight/NZBContents.php +++ b/Blacklight/NZBContents.php @@ -139,12 +139,11 @@ class NZBContents * Gets the completion from the NZB, optionally looks if there is an NFO/PAR2 file. * * - * @param bool $nfoCheck * @return array|false * * @throws \Exception */ - public function parseNZB($guid, $relID, $groupID, $nfoCheck = false) + public function parseNZB($guid, $relID, $groupID, bool $nfoCheck = false) { $nzbFile = $this->LoadNZB($guid); if ($nzbFile !== false) { @@ -243,15 +242,10 @@ class NZBContents /** * Attempts to get the releasename from a par2 file. * - * @param string $guid - * @param int $relID - * @param int $groupID - * @param int $nameStatus - * @param int $show * * @throws \Exception */ - public function checkPAR2($guid, $relID, $groupID, $nameStatus, $show): bool + public function checkPAR2(string $guid, int $relID, int $groupID, int $nameStatus, int $show): bool { $nzbFile = $this->LoadNZB($guid); if ($nzbFile !== false) { diff --git a/Blacklight/NZBImport.php b/Blacklight/NZBImport.php index 856253b8d..96177548b 100755 --- a/Blacklight/NZBImport.php +++ b/Blacklight/NZBImport.php @@ -129,7 +129,7 @@ class NZBImport * * @throws \Exception */ - public function beginImport($filesToProcess, $useNzbName = false, $delete = true, $deleteFailed = true) + public function beginImport(array $filesToProcess, $useNzbName = false, bool $delete = true, bool $deleteFailed = true) { // Get all the groups in the DB. if (! $this->getAllGroups()) { @@ -241,11 +241,10 @@ class NZBImport } /** - * @param bool $useNzbName * * @throws \Exception */ - protected function scanNZBFile(&$nzbXML, $useNzbName = false): bool + protected function scanNZBFile(&$nzbXML, bool $useNzbName = false): bool { $binary_names = []; $totalFiles = $totalSize = $groupID = 0; @@ -456,10 +455,8 @@ class NZBImport /** * Echo message to browser or CLI. - * - * @param string $message */ - protected function echoOut($message): void + protected function echoOut(string $message): void { if ($this->browser) { $this->retVal .= $message.'
'; diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php index b360adb65..3d95fbf9f 100755 --- a/Blacklight/NameFixer.php +++ b/Blacklight/NameFixer.php @@ -1449,12 +1449,10 @@ class NameFixer /** * Look for a TV name. * - * @param bool $echo - * @param string $type * * @throws \Exception */ - public function tvCheck($release, $echo, $type, $nameStatus, $show): void + public function tvCheck($release, bool $echo, string $type, $nameStatus, $show): void { $result = []; diff --git a/Blacklight/Nfo.php b/Blacklight/Nfo.php index 796af1c65..b69b01425 100755 --- a/Blacklight/Nfo.php +++ b/Blacklight/Nfo.php @@ -88,7 +88,7 @@ class Nfo * @param string $str The string with a Show ID. * @return array|false Return array with show ID and site source or false on failure. */ - public function parseShowId($str) + public function parseShowId(string $str) { $return = false; @@ -128,7 +128,7 @@ class Nfo * * @throws \Exception */ - public function isNFO(&$possibleNFO, $guid): bool + public function isNFO(&$possibleNFO, string $guid): bool { if ($possibleNFO === false) { return false; @@ -195,7 +195,7 @@ class Nfo * * @throws \Exception */ - public function addAlternateNfo(&$nfo, $release, $nntp): bool + public function addAlternateNfo(string &$nfo, $release, NNTP $nntp): bool { if ($release->id > 0 && $this->isNFO($nfo, $release->guid)) { $check = ReleaseNfo::whereReleasesId($release->id)->first(['releases_id']); @@ -240,7 +240,7 @@ class Nfo * * @throws \Exception */ - public function processNfoFiles($nntp, $groupID = '', $guidChar = '', $processImdb = 1, $processTv = 1): int + public function processNfoFiles($nntp, string $groupID = '', string $guidChar = '', int $processImdb = 1, int $processTv = 1): int { $ret = 0; @@ -265,7 +265,7 @@ class Nfo $res = $qry ->orderBy('nfostatus') - ->orderBy('postdate', 'desc') + ->orderByDesc('postdate') ->limit($this->nzbs) ->get(['id', 'guid', 'groups_id', 'name']); diff --git a/Blacklight/Regexes.php b/Blacklight/Regexes.php index 0703e11b3..7719be010 100755 --- a/Blacklight/Regexes.php +++ b/Blacklight/Regexes.php @@ -95,19 +95,16 @@ class Regexes /** * Get a single regex using its id. - * - * @param int $id */ - public function getRegexByID($id): array + public function getRegexByID(int $id): array { return (array) Arr::first(DB::select(sprintf('SELECT * FROM %s WHERE id = %d LIMIT 1', $this->tableName, $id))); } /** - * @param string $group_regex * @return mixed */ - public function getRegex($group_regex = '') + public function getRegex(string $group_regex = '') { if ($this->tableName === 'collection_regexes') { $table = CollectionRegex::class; @@ -131,7 +128,7 @@ class Regexes * * @param string $group_regex Optional, keyword to find a group. */ - public function getCount($group_regex = ''): int + public function getCount(string $group_regex = ''): int { $query = DB::select( sprintf( @@ -147,11 +144,10 @@ class Regexes /** * Delete a regex using its id. * - * @param int $id * * @throws \Throwable */ - public function deleteRegex($id): void + public function deleteRegex(int $id): void { DB::transaction(function () use ($id) { DB::delete(sprintf('DELETE FROM %s WHERE id = %d', $this->tableName, $id)); @@ -163,13 +159,10 @@ class Regexes * * Requires table per group to be on. * - * @param string $groupName - * @param string $regex - * @param int $limit * * @throws \Exception */ - public function testCollectionRegex($groupName, $regex, $limit): array + public function testCollectionRegex(string $groupName, string $regex, int $limit): array { $groupID = UsenetGroup::getIDByName($groupName); @@ -326,12 +319,10 @@ class Regexes * * Requires at least 1 named captured group. * - * @param string $regex - * @param string $subject * * @throws \Exception */ - protected function _matchRegex($regex, $subject): string + protected function _matchRegex(string $regex, string $subject): string { $returnString = ''; if (preg_match($regex, $subject, $hits) && \count($hits) > 0) { @@ -359,10 +350,8 @@ class Regexes /** * Format part of a query. - * - * @param string $group_regex */ - protected function _groupQueryString($group_regex): string + protected function _groupQueryString(string $group_regex): string { return $group_regex ? ('WHERE group_regex LIKE '.escapeString('%'.$group_regex.'%')) : ''; } diff --git a/Blacklight/ReleaseCleaning.php b/Blacklight/ReleaseCleaning.php index 3da62e6c0..6f5b87462 100755 --- a/Blacklight/ReleaseCleaning.php +++ b/Blacklight/ReleaseCleaning.php @@ -97,12 +97,11 @@ class ReleaseCleaning } /** - * @param bool $usePre * @return array|false|string * * @throws \Exception */ - public function releaseCleaner($subject, $fromName, $groupName, $usePre = false) + public function releaseCleaner($subject, $fromName, $groupName, bool $usePre = false) { $hit = $hits = []; // Get pre style name from releases.name @@ -402,10 +401,7 @@ class ReleaseCleaning // Run at the end because this can be dangerous. In the future it's better to make these per group. There should not be numbers after yEnc because we remove them as well before inserting (even when importing). - /** - * @return array - */ - public function generic() + public function generic(): array { // This regex gets almost all of the predb release names also keep in mind that not every subject ends with yEnc, some are truncated, because of the 255 character limit and some have extra charaters tacked onto the end, like (5/10). if (preg_match( diff --git a/Blacklight/ReleaseExtra.php b/Blacklight/ReleaseExtra.php index 01f031409..12ec91c3c 100755 --- a/Blacklight/ReleaseExtra.php +++ b/Blacklight/ReleaseExtra.php @@ -67,10 +67,7 @@ class ReleaseExtra return ReleaseSubtitle::query()->where('releases_id', $id)->select([DB::raw("GROUP_CONCAT(subslanguage SEPARATOR ', ') AS subs")])->orderBy('subsid')->first(); } - /** - * @param string $guid - */ - public function getBriefByGuid($guid): array + public function getBriefByGuid(string $guid): array { return DB::select(sprintf("SELECT containerformat, videocodec, videoduration, videoaspect, CONCAT(video_data.videowidth,'x',video_data.videoheight,' @',format(videoframerate,0),'fps') AS size, @@ -318,11 +315,7 @@ class ReleaseExtra } } - /** - * @param int $releaseID - * @param string $uniqueId - */ - public function addUID($releaseID, $uniqueId): void + public function addUID(int $releaseID, string $uniqueId): void { $dupecheck = ReleaseUnique::query()->where('releases_id', $releaseID)->orWhere([ 'releases_id' => $releaseID, diff --git a/Blacklight/ReleaseRemover.php b/Blacklight/ReleaseRemover.php index c2db6827f..509fd806c 100755 --- a/Blacklight/ReleaseRemover.php +++ b/Blacklight/ReleaseRemover.php @@ -147,7 +147,7 @@ class ReleaseRemover * * @throws \Exception */ - public function removeByCriteria($arguments) + public function removeByCriteria(array $arguments) { $this->delete = true; $this->ignoreUserCheck = false; @@ -212,7 +212,7 @@ class ReleaseRemover * * @throws \Exception */ - public function removeCrap($delete, $time, $type = '', $blacklistID = '') + public function removeCrap(bool $delete, $time, string $type = '', $blacklistID = '') { $timeStart = now(); $this->delete = $delete; @@ -1037,7 +1037,6 @@ class ReleaseRemover /** * Delete releases from the database. * - * @return true * * @throws \Exception */ @@ -1089,7 +1088,7 @@ class ReleaseRemover * @param string $argument User argument. * @return string|false */ - protected function formatCriteriaQuery($argument) + protected function formatCriteriaQuery(string $argument) { // Check if the user wants to ignore the check. if ($argument === 'ignore') { @@ -1257,10 +1256,8 @@ class ReleaseRemover /** * Check if the user wants to run the current query. - * - * @return bool */ - protected function checkUserResponse() + protected function checkUserResponse(): bool { if ($this->ignoreUserCheck || $this->browser) { return true; @@ -1287,10 +1284,8 @@ class ReleaseRemover /** * Remove multiple spaces and trim leading spaces. - * - * @param string $string */ - protected function cleanSpaces($string): string + protected function cleanSpaces(string $string): string { return trim(preg_replace('/\s{2,}/', ' ', $string)); } @@ -1301,7 +1296,7 @@ class ReleaseRemover * @param string $string The string to format. * @param string $type The column name. */ - protected function formatLike($string, $type): string + protected function formatLike(string $string, string $type): string { $newString = explode(' ', $string); if (\count($newString) > 1) { @@ -1331,10 +1326,9 @@ class ReleaseRemover } /** - * @param string $dbRegex * @return bool|mixed|string */ - protected function extractSrchFromRegx($dbRegex = '') + protected function extractSrchFromRegx(string $dbRegex = '') { $regexMatch = ''; diff --git a/Blacklight/Releases.php b/Blacklight/Releases.php index 4958c3830..73a81696b 100644 --- a/Blacklight/Releases.php +++ b/Blacklight/Releases.php @@ -340,8 +340,6 @@ class Releases extends Release * * @param array $identifiers ['g' => Release GUID(mandatory), 'id => ReleaseID(optional, pass * false)] - * @param \Blacklight\NZB $nzb - * @param \Blacklight\ReleaseImage $releaseImage * * @throws \Exception */ diff --git a/Blacklight/Tmux.php b/Blacklight/Tmux.php index 38adc5c72..6e99b131d 100755 --- a/Blacklight/Tmux.php +++ b/Blacklight/Tmux.php @@ -195,10 +195,7 @@ class Tmux return $sql; } - /** - * @return int - */ - public function updateItem($setting, $value) + public function updateItem($setting, $value): int { return Settings::query()->where('setting', '=', $setting)->update(['value' => $value]); } @@ -261,11 +258,10 @@ class Tmux * Returns random bool, weighted by $chance. * * - * @param int $chance * * @throws \Exception */ - public function rand_bool($loop, $chance = 60): bool + public function rand_bool($loop, int $chance = 60): bool { $usecache = Settings::settingValue('site.tmux.usecache') ?? 0; if ($loop === 1 || $usecache === 0) { @@ -288,13 +284,10 @@ class Tmux } /** - * @param string $db_name - * @param string $ppmax - * @param string $ppmin * * @throws \Exception */ - public function proc_query($qry, $bookreqids, $db_name, $ppmax = '', $ppmin = ''): bool|string + public function proc_query($qry, $bookreqids, string $db_name, string $ppmax = '', string $ppmin = ''): bool|string { switch ((int) $qry) { case 1: diff --git a/Blacklight/XXX.php b/Blacklight/XXX.php index 948d41b39..6a4c97f85 100755 --- a/Blacklight/XXX.php +++ b/Blacklight/XXX.php @@ -85,10 +85,8 @@ class XXX /** * Get XXX releases with covers for xxx browse page. - * - * @param int $maxAge */ - public function getXXXRange($page, $cat, $start, $num, $orderBy, $maxAge = -1, array $excludedCats = []): array + public function getXXXRange($page, $cat, $start, $num, $orderBy, int $maxAge = -1, array $excludedCats = []): array { $catSrch = ''; if (\count($cat) > 0 && $cat[0] !== -1) { diff --git a/Blacklight/libraries/Geary.php b/Blacklight/libraries/Geary.php index d0822c917..7c513fe9a 100644 --- a/Blacklight/libraries/Geary.php +++ b/Blacklight/libraries/Geary.php @@ -48,7 +48,7 @@ class Geary * @param string $gateway_id Your API key obtained from https://admin.gear.mycelium.com/gateways * @param string $gateway_secret Your API secret obtained from https://admin.gear.mycelium.com/gateways */ - public function __construct($gateway_id, $gateway_secret) + public function __construct(string $gateway_id, string $gateway_secret) { $this->gateway_id = $gateway_id; $this->gateway_secret = $gateway_secret; @@ -66,7 +66,7 @@ class Geary * normally in satoshis * @return mixed */ - public function create_order($amount, $keychain_id, $callback_data) + public function create_order(float $amount, $keychain_id, $callback_data) { $request = $this->endpoint('orders'); $params = [ @@ -92,7 +92,7 @@ class Geary * @param int $id Id is an existing order ID or payment ID * @return mixed */ - public function cancel_order($id) + public function cancel_order(int $id) { $request = $this->endpoint('orders'); @@ -113,7 +113,7 @@ class Geary * @param int $payment_id Id is an existing payment ID * @return mixed */ - public function check_order($payment_id) + public function check_order(int $payment_id) { $request_uri = $this->endpoint('orders'); @@ -173,7 +173,7 @@ class Geary * * @param int $id Id is an existing order ID */ - public function order_websocket_link($id): string + public function order_websocket_link(int $id): string { return "wss://gateway.gear.mycelium.com/gateways/{$this->gateway_id}/orders/$id/websocket"; } @@ -219,10 +219,8 @@ class Geary * Endpoint. * * Construct an endpoint URL - * - * @param string $method */ - private function endpoint($method): string + private function endpoint(string $method): string { return "/gateways/{$this->gateway_id}/$method"; } @@ -255,10 +253,8 @@ class Geary * Get Header. * * Get single data from header - * - * @param string $name */ - private function get_header($name): string + private function get_header(string $name): string { $headers = getAllHeaders(); @@ -277,10 +273,8 @@ class Geary * Prepare Header. * * Add data to header for authentication purpose - * - * @param array $data */ - private function prepare_header($data): array + private function prepare_header(array $data): array { $params = $data['params']; $params_query = ! \is_array($params) ? "/$params" : '?'.http_build_query($params); @@ -304,10 +298,9 @@ class Geary * * Send a signed HTTP request * - * @param array $data * @return mixed */ - private function send_signed_request($data) + private function send_signed_request(array $data) { $ch = curl_init(); $url = self::API_URL.$data['request_uri']; diff --git a/Blacklight/processing/adult/ADE.php b/Blacklight/processing/adult/ADE.php index f824f338f..939c677c3 100755 --- a/Blacklight/processing/adult/ADE.php +++ b/Blacklight/processing/adult/ADE.php @@ -68,7 +68,7 @@ class ADE extends AdultMovies * * @return array - url, streamid, basestreamingurl */ - protected function trailers() + protected function trailers(): array { $this->_response = getRawHtml(self::ADE.$this->_trailers.$this->_directUrl); $this->_html->loadHtml($this->_response); @@ -100,7 +100,7 @@ class ADE extends AdultMovies * * @return array - Boxcover and backcover */ - protected function covers() + protected function covers(): array { if ($ret = $this->_html->find('div#Boxcover, img[itemprop=image]', 1)) { $this->_res['boxcover'] = preg_replace('/m\.jpg/', 'h.jpg', $ret->src); @@ -115,7 +115,7 @@ class ADE extends AdultMovies * * @return array - plot */ - protected function synopsis() + protected function synopsis(): array { $ret = $this->_html->findOne('meta[name=og:description]')->content; if ($ret !== false) { @@ -165,10 +165,9 @@ class ADE extends AdultMovies /** * Gets Product Information and/or Features. * - * @param bool $extras * @return array - ProductInfo/Extras = features */ - protected function productInfo($extras = false) + protected function productInfo(bool $extras = false): array { $dofeature = null; $this->_tmpResponse = str_ireplace('Section ProductInfo', 'spdinfo', $this->_response); @@ -202,10 +201,9 @@ class ADE extends AdultMovies /** * Searches xxx name. * - * @param string $movie * @return bool - True if releases has 90% match, else false */ - public function processSite($movie): bool + public function processSite(string $movie): bool { if (empty($movie)) { return false; diff --git a/Blacklight/processing/adult/ADM.php b/Blacklight/processing/adult/ADM.php index e74eb6ae6..ee5396390 100755 --- a/Blacklight/processing/adult/ADM.php +++ b/Blacklight/processing/adult/ADM.php @@ -74,7 +74,7 @@ class ADM extends AdultMovies * * @return array - boxcover,backcover */ - protected function covers() + protected function covers(): array { $baseUrl = 'http://www.adultdvdmarketplace.com/'; if ($ret = $this->_html->find('a[rel=fancybox-button]', 0)) { @@ -108,11 +108,8 @@ class ADM extends AdultMovies /** * Get Product Information and Director. - * - * - * @param bool $extras */ - protected function productInfo($extras = false): array + protected function productInfo(bool $extras = false): array { foreach ($this->_html->find('ul.list-unstyled li') as $li) { $category = explode(':', $li->plaintext); diff --git a/Blacklight/processing/adult/AEBN.php b/Blacklight/processing/adult/AEBN.php index f7577e1b3..9450010de 100755 --- a/Blacklight/processing/adult/AEBN.php +++ b/Blacklight/processing/adult/AEBN.php @@ -141,10 +141,8 @@ class AEBN extends AdultMovies /** * Gets the product information. - * - * @param bool $extras */ - protected function productInfo($extras = false): array + protected function productInfo(bool $extras = false): array { if ($ret = $this->_html->find('div#md-detailsLeft', 0)) { foreach ($ret->find('div') as $div) { @@ -187,10 +185,8 @@ class AEBN extends AdultMovies /** * Searches for a XXX name. - * - * @param string $movie */ - public function processSite($movie): bool + public function processSite(string $movie): bool { if (empty($movie)) { return false; diff --git a/Blacklight/processing/adult/Hotmovies.php b/Blacklight/processing/adult/Hotmovies.php index cb748d7df..bdc5ed9e9 100755 --- a/Blacklight/processing/adult/Hotmovies.php +++ b/Blacklight/processing/adult/Hotmovies.php @@ -100,10 +100,8 @@ class Hotmovies extends AdultMovies /** * Process ProductInfo. - * - * @param bool $extras */ - protected function productInfo($extras = false): array + protected function productInfo(bool $extras = false): array { $studio = false; $director = false; @@ -200,10 +198,9 @@ class Hotmovies extends AdultMovies /** * Searches for match against xxx movie name. * - * @param string $movie * @return bool , true if search >= 90% */ - public function processSite($movie): bool + public function processSite(string $movie): bool { if (empty($movie)) { return false; diff --git a/Blacklight/processing/adult/Popporn.php b/Blacklight/processing/adult/Popporn.php index 087d0a17f..911d4dea0 100755 --- a/Blacklight/processing/adult/Popporn.php +++ b/Blacklight/processing/adult/Popporn.php @@ -139,10 +139,9 @@ class Popporn extends AdultMovies } /** - * @param bool $extras * @return array|mixed */ - protected function productInfo($extras = false) + protected function productInfo(bool $extras = false) { $country = false; if ($ret = $this->_html->findOne('div#lside')) { @@ -230,10 +229,8 @@ class Popporn extends AdultMovies /** * Gets categories. - * - * @return array */ - protected function genres() + protected function genres(): array { $genres = []; if ($ret = $this->_html->find('div[id=thekeywords], p[class=keywords]', 1)) { @@ -249,10 +246,9 @@ class Popporn extends AdultMovies /** * Searches for match against searchterm. * - * @param string $movie * @return bool , true if search >= 90% */ - public function processSite($movie): bool + public function processSite(string $movie): bool { if (! empty($movie)) { $this->_trailUrl = self::TRAILINGSEARCH.$movie; diff --git a/Blacklight/processing/post/AniDB.php b/Blacklight/processing/post/AniDB.php index b45ccb188..fa045e802 100755 --- a/Blacklight/processing/post/AniDB.php +++ b/Blacklight/processing/post/AniDB.php @@ -119,10 +119,9 @@ class AniDB /** * Selects episode info for a local match. * - * @param int $episode * @return \Illuminate\Database\Eloquent\Model|null|static */ - private function checkAniDBInfo($anidbId, $episode = -1) + private function checkAniDBInfo($anidbId, int $episode = -1) { return AnidbEpisode::query()->where( [ @@ -153,10 +152,9 @@ class AniDB /** * Extracts anime title and episode info from release searchname. * - * @param string $cleanName * @return array $hits */ - private function extractTitleEpisode($cleanName = ''): array + private function extractTitleEpisode(string $cleanName = ''): array { $cleanName = str_replace('_', ' ', $cleanName); @@ -194,10 +192,9 @@ class AniDB * Retrieves AniDB Info using a cleaned name. * * - * @param string $searchName * @return mixed */ - private function getAnidbByName($searchName = '') + private function getAnidbByName(string $searchName = '') { return DB::selectOne( sprintf( diff --git a/Blacklight/processing/tv/TMDB.php b/Blacklight/processing/tv/TMDB.php index 6633543b7..f80f0861b 100644 --- a/Blacklight/processing/tv/TMDB.php +++ b/Blacklight/processing/tv/TMDB.php @@ -41,10 +41,8 @@ class TMDB extends TV /** * Main processing director function for TMDB * Calls work query function and initiates processing. - * - * @param bool $local */ - public function processSite($groupID, $guidChar, $process, $local = false): void + public function processSite($groupID, $guidChar, $process, bool $local = false): void { $res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TMDB); @@ -183,10 +181,9 @@ class TMDB extends TV * Calls the API to perform initial show name match to TMDB title * Returns a formatted array of show data or false if no match. * - * @param string $cleanName * @return array|false */ - protected function getShowInfo($cleanName): bool|array + protected function getShowInfo(string $cleanName): bool|array { $return = $response = false; @@ -261,7 +258,7 @@ class TMDB extends TV * * @param int $videoId -- the local Video ID */ - public function getPoster($videoId): int + public function getPoster(int $videoId): int { $ri = new ReleaseImage(); @@ -284,14 +281,9 @@ class TMDB extends TV * Gets the specific episode info for the parsed release after match * Returns a formatted array of episode data or false if no match. * - * @param int $tmdbid - * @param int $season - * @param int $episode - * @param string $airdate - * @param int $videoId * @return array|false */ - protected function getEpisodeInfo($tmdbid, $season, $episode, $airdate = '', $videoId = 0): bool|array + protected function getEpisodeInfo(int $tmdbid, int $season, int $episode, string $airdate = '', int $videoId = 0): bool|array { $return = false; diff --git a/Blacklight/processing/tv/TV.php b/Blacklight/processing/tv/TV.php index 24ba5da99..2817456c8 100755 --- a/Blacklight/processing/tv/TV.php +++ b/Blacklight/processing/tv/TV.php @@ -157,7 +157,7 @@ abstract class TV extends Videos ->where('size', '>', 1048576) ->whereBetween('categories_id', [Category::TV_ROOT, Category::TV_OTHER]) ->where('categories_id', '<>', Category::TV_ANIME) - ->orderBy('postdate', 'desc') + ->orderByDesc('postdate') ->limit($this->tvqty); if ($groupID !== '') { $qry->where('groups_id', $groupID); diff --git a/Blacklight/processing/tv/TVDB.php b/Blacklight/processing/tv/TVDB.php index 7c34d54bb..2b81a8052 100755 --- a/Blacklight/processing/tv/TVDB.php +++ b/Blacklight/processing/tv/TVDB.php @@ -60,10 +60,8 @@ class TVDB extends TV /** * Main processing director function for scrapers * Calls work query function and initiates processing. - * - * @param bool $local */ - public function processSite($groupID, $guidChar, $process, $local = false): void + public function processSite($groupID, $guidChar, $process, bool $local = false): void { $res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TVDB); @@ -273,7 +271,7 @@ class TVDB extends TV * * @param int $videoId -- the local Video ID */ - public function getPoster($videoId): int + public function getPoster(int $videoId): int { $ri = new ReleaseImage(); diff --git a/Blacklight/processing/tv/TVMaze.php b/Blacklight/processing/tv/TVMaze.php index 3bd02e0b0..4972bba5a 100644 --- a/Blacklight/processing/tv/TVMaze.php +++ b/Blacklight/processing/tv/TVMaze.php @@ -49,10 +49,8 @@ class TVMaze extends TV /** * Main processing director function for scrapers * Calls work query function and initiates processing. - * - * @param bool $local */ - public function processSite($groupID, $guidChar, $process, $local = false): void + public function processSite($groupID, $guidChar, $process, bool $local = false): void { $res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TVMAZE); @@ -213,10 +211,9 @@ class TVMaze extends TV * Returns a formatted array of show data or false if no match. * * - * @param string $cleanName * @return array|false */ - protected function getShowInfo($cleanName) + protected function getShowInfo(string $cleanName) { $return = $response = false; @@ -296,7 +293,7 @@ class TVMaze extends TV * * @param int $videoId -- the local Video ID */ - public function getPoster($videoId): int + public function getPoster(int $videoId): int { $ri = new ReleaseImage(); @@ -319,14 +316,9 @@ class TVMaze extends TV * Gets the specific episode info for the parsed release after match * Returns a formatted array of episode data or false if no match. * - * @param int $tvMazeId - * @param int $season - * @param int $episode - * @param string $airDate - * @param int $videoId * @return array|false */ - protected function getEpisodeInfo($tvMazeId, $season, $episode, $airDate = '', $videoId = 0) + protected function getEpisodeInfo(int $tvMazeId, int $season, int $episode, string $airDate = '', int $videoId = 0) { $return = $response = false; diff --git a/Blacklight/processing/tv/TraktTv.php b/Blacklight/processing/tv/TraktTv.php index 9bd5e870f..255128841 100755 --- a/Blacklight/processing/tv/TraktTv.php +++ b/Blacklight/processing/tv/TraktTv.php @@ -64,10 +64,8 @@ class TraktTv extends TV /** * Main processing director function for scrapers * Calls work query function and initiates processing. - * - * @param bool $local */ - public function processSite($groupID, $guidChar, $process, $local = false): void + public function processSite($groupID, $guidChar, $process, bool $local = false): void { $res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TRAKT); @@ -197,12 +195,9 @@ class TraktTv extends TV /** * Retrieve info of TV episode from site using its API. * - * @param int $siteId - * @param int $series - * @param int $episode * @return array|false False on failure, an array of information fields otherwise. */ - public function getEpisodeInfo($siteId, $series, $episode) + public function getEpisodeInfo(int $siteId, int $series, int $episode) { $return = false; @@ -228,7 +223,7 @@ class TraktTv extends TV * * @param int $videoId ID from videos table. */ - public function getPoster($videoId): int + public function getPoster(int $videoId): int { $hascover = 0; $ri = new ReleaseImage(); diff --git a/Blacklight/utility/Country.php b/Blacklight/utility/Country.php index b750c7a31..31baf4e5d 100755 --- a/Blacklight/utility/Country.php +++ b/Blacklight/utility/Country.php @@ -32,10 +32,9 @@ class Country /** * Get a country code for a country name. * - * @param string $country * @return mixed */ - public static function countryCode($country) + public static function countryCode(string $country) { if (\strlen($country) > 2) { $code = CountryModel::whereFullName($country)->orWhere('name', $country)->first(['iso_3166_2']); diff --git a/app/Console/Commands/InstallNntmux.php b/app/Console/Commands/InstallNntmux.php index 76e452ffe..1e7322e0e 100644 --- a/app/Console/Commands/InstallNntmux.php +++ b/app/Console/Commands/InstallNntmux.php @@ -35,7 +35,7 @@ class InstallNntmux extends Command parent::__construct(); } - public function handle() + public function handle(): void { $error = false; diff --git a/app/Console/Commands/NntmuxDeleteUnVerifiedUsers.php b/app/Console/Commands/NntmuxDeleteUnVerifiedUsers.php index daed3f240..c919ddf39 100644 --- a/app/Console/Commands/NntmuxDeleteUnVerifiedUsers.php +++ b/app/Console/Commands/NntmuxDeleteUnVerifiedUsers.php @@ -33,10 +33,8 @@ class NntmuxDeleteUnVerifiedUsers extends Command /** * Execute the console command. - * - * @return mixed */ - public function handle() + public function handle(): void { $this->info('Deleting unverified users.'); User::deleteUnVerified(); diff --git a/app/Console/Commands/NntmuxPopulateSearchIndexes.php b/app/Console/Commands/NntmuxPopulateSearchIndexes.php index 8f41d961a..3567f6c3a 100644 --- a/app/Console/Commands/NntmuxPopulateSearchIndexes.php +++ b/app/Console/Commands/NntmuxPopulateSearchIndexes.php @@ -36,7 +36,7 @@ class NntmuxPopulateSearchIndexes extends Command /** * Execute the console command. */ - public function handle() + public function handle(): int { if ($this->option('releases') && $this->option('manticore')) { $this->manticoreReleases(); @@ -143,10 +143,7 @@ class NntmuxPopulateSearchIndexes extends Command $this->newLine(); } - /** - * @return void - */ - private function elasticReleases() + private function elasticReleases(): void { $elastic = new ElasticSearchSiteSearch(); $total = Release::count(); @@ -189,10 +186,7 @@ class NntmuxPopulateSearchIndexes extends Command $this->info('Done'); } - /** - * @return void - */ - private function elasticPreDB() + private function elasticPreDB(): void { $elastic = new ElasticSearchSiteSearch(); $total = Predb::count(); diff --git a/app/Console/Commands/NntmuxRemoveBadReleases.php b/app/Console/Commands/NntmuxRemoveBadReleases.php index b9de2d14c..931e4ac4b 100644 --- a/app/Console/Commands/NntmuxRemoveBadReleases.php +++ b/app/Console/Commands/NntmuxRemoveBadReleases.php @@ -35,11 +35,10 @@ class NntmuxRemoveBadReleases extends Command /** * Execute the console command. * - * @return mixed * * @throws \Exception */ - public function handle() + public function handle(): void { Release::query()->where('passwordstatus', '=', -2)->delete(); diff --git a/app/Console/Commands/NntmuxResetDb.php b/app/Console/Commands/NntmuxResetDb.php index 393e48cf4..f10b4f706 100644 --- a/app/Console/Commands/NntmuxResetDb.php +++ b/app/Console/Commands/NntmuxResetDb.php @@ -38,7 +38,7 @@ class NntmuxResetDb extends Command /** * @throws \Exception */ - public function handle() + public function handle(): void { if ($this->confirm('This script removes all releases, nzb files, samples, previews , nfos, truncates all article tables and resets all groups. Are you sure you want reset the DB?')) { $timestart = now(); diff --git a/app/Console/Commands/NntmuxResetPostProcessing.php b/app/Console/Commands/NntmuxResetPostProcessing.php index 30a121d3a..832439e5e 100644 --- a/app/Console/Commands/NntmuxResetPostProcessing.php +++ b/app/Console/Commands/NntmuxResetPostProcessing.php @@ -48,10 +48,8 @@ class NntmuxResetPostProcessing extends Command /** * Execute the console command. - * - * @return mixed */ - public function handle() + public function handle(): void { if (empty($this->option('category'))) { $qry = Release::query()->select(['id'])->get(); diff --git a/app/Console/Commands/NntmuxResetTruncate.php b/app/Console/Commands/NntmuxResetTruncate.php index 969351ec0..c552c376a 100644 --- a/app/Console/Commands/NntmuxResetTruncate.php +++ b/app/Console/Commands/NntmuxResetTruncate.php @@ -36,7 +36,7 @@ class NntmuxResetTruncate extends Command /** * Execute the console command. */ - public function handle() + public function handle(): void { UsenetGroup::query()->update(['first_record' => 0, 'first_record_postdate' => null, 'last_record' => 0, 'last_record_postdate' => null, 'last_updated' => null]); $this->info('Reseting all groups completed.'); diff --git a/app/Console/Commands/NntmuxUpdateExpiredRoles.php b/app/Console/Commands/NntmuxUpdateExpiredRoles.php index b0c73e69a..59ca27dff 100644 --- a/app/Console/Commands/NntmuxUpdateExpiredRoles.php +++ b/app/Console/Commands/NntmuxUpdateExpiredRoles.php @@ -33,10 +33,8 @@ class NntmuxUpdateExpiredRoles extends Command /** * Execute the console command. - * - * @return mixed */ - public function handle() + public function handle(): void { $this->info('Updating expired roles.'); $this->info('Updating users that will have their roles expire or are already expired'); diff --git a/app/Console/Commands/TmuxUIRestart.php b/app/Console/Commands/TmuxUIRestart.php index 7f0c4f95b..1ca847a2d 100644 --- a/app/Console/Commands/TmuxUIRestart.php +++ b/app/Console/Commands/TmuxUIRestart.php @@ -33,7 +33,7 @@ class TmuxUIRestart extends Command /** * Execute the console command. */ - public function handle() + public function handle(): void { $this->call('tmux-ui:stop', ['--kill' => true]); $this->call('tmux-ui:start'); diff --git a/app/Console/Commands/TmuxUIStart.php b/app/Console/Commands/TmuxUIStart.php index 7ae98456d..8c88066ac 100644 --- a/app/Console/Commands/TmuxUIStart.php +++ b/app/Console/Commands/TmuxUIStart.php @@ -26,7 +26,7 @@ class TmuxUIStart extends Command /** * Execute the console command. */ - public function handle() + public function handle(): void { $tmux = new Tmux(); $tmux_session = Settings::settingValue('site.tmux.tmux_session') ?? 0; diff --git a/app/Console/Commands/TmuxUIStop.php b/app/Console/Commands/TmuxUIStop.php index cfd800ef3..dcf38c865 100644 --- a/app/Console/Commands/TmuxUIStop.php +++ b/app/Console/Commands/TmuxUIStop.php @@ -26,7 +26,7 @@ class TmuxUIStop extends Command /** * @throws \Exception */ - public function handle() + public function handle(): void { $tmux = new Tmux(); $tmux->stopIfRunning(); diff --git a/app/Console/Commands/UpdateNNTmuxDB.php b/app/Console/Commands/UpdateNNTmuxDB.php index 947f428ce..a9f20f917 100644 --- a/app/Console/Commands/UpdateNNTmuxDB.php +++ b/app/Console/Commands/UpdateNNTmuxDB.php @@ -28,7 +28,7 @@ class UpdateNNTmuxDB extends Command parent::__construct(); } - public function handle() + public function handle(): void { // also prevent web access. $this->output->writeln('Updating database'); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 770fec518..9b2a62220 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -19,10 +19,8 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. - * - * @return void */ - protected function schedule(Schedule $schedule) + protected function schedule(Schedule $schedule): void { $schedule->command('disposable:update')->weekly(); $schedule->command('clean:directories')->hourly()->withoutOverlapping(); @@ -40,10 +38,8 @@ class Kernel extends ConsoleKernel /** * Register the commands for the application. - * - * @return void */ - protected function commands() + protected function commands(): void { $this->load(__DIR__.'/Commands'); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 2fdc1d932..76dcc0acb 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -28,10 +28,8 @@ class Handler extends ExceptionHandler /** * Catch errors with Sentry. - * - * @return void */ - public function register() + public function register(): void { $this->reportable(function (Throwable $e) { if (app()->bound('sentry')) { @@ -44,7 +42,6 @@ class Handler extends ExceptionHandler * Report or log an exception. * * - * @param \Exception $exception * @return void * * @throws \Throwable diff --git a/app/Extensions/util/PhpYenc.php b/app/Extensions/util/PhpYenc.php index 2cb7415ca..2baf632d3 100644 --- a/app/Extensions/util/PhpYenc.php +++ b/app/Extensions/util/PhpYenc.php @@ -25,10 +25,7 @@ namespace App\Extensions\util; */ class PhpYenc { - /** - * @param bool $ignore - */ - public static function decode(&$text, $ignore = false): bool|string + public static function decode(&$text, bool $ignore = false): bool|string { $crc = ''; // Extract the yEnc string itself. diff --git a/app/Http/Controllers/Admin/AdminAnidbController.php b/app/Http/Controllers/Admin/AdminAnidbController.php index 27e5665f6..7993cba85 100644 --- a/app/Http/Controllers/Admin/AdminAnidbController.php +++ b/app/Http/Controllers/Admin/AdminAnidbController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Admin; +use Illuminate\Http\Request; use App\Http\Controllers\BasePageController; use App\Models\Release; use Blacklight\AniDB; @@ -11,7 +12,7 @@ class AdminAnidbController extends BasePageController /** * @throws \Exception */ - public function index(): void + public function index(Request $request): void { $this->setAdminPrefs(); @@ -19,8 +20,8 @@ class AdminAnidbController extends BasePageController $title = $meta_title = 'AniDB List'; $aname = ''; - if (request()->has('animetitle') && ! empty(request()->input('animetitle'))) { - $aname = request()->input('animetitle'); + if ($request->has('animetitle') && ! empty($request->input('animetitle'))) { + $aname = $request->input('animetitle'); } $this->smarty->assign('animetitle', $aname); @@ -38,36 +39,36 @@ class AdminAnidbController extends BasePageController /** * @throws \Exception */ - public function edit(int $id): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse + public function edit(Request $request, int $id): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse { $this->setAdminPrefs(); $AniDB = new AniDB(); // Set the current action. - $action = request()->input('action') ?? 'view'; + $action = $request->input('action') ?? 'view'; switch ($action) { case 'submit': $AniDB->updateTitle( - request()->input('anidbid'), - request()->input('title'), - request()->input('type'), - request()->input('startdate'), - request()->input('enddate'), - request()->input('related'), - request()->input('similar'), - request()->input('creators'), - request()->input('description'), - request()->input('rating'), - request()->input('categories'), - request()->input('characters'), - request()->input('epnos'), - request()->input('airdates'), - request()->input('episodetitles') + $request->input('anidbid'), + $request->input('title'), + $request->input('type'), + $request->input('startdate'), + $request->input('enddate'), + $request->input('related'), + $request->input('similar'), + $request->input('creators'), + $request->input('description'), + $request->input('rating'), + $request->input('categories'), + $request->input('characters'), + $request->input('epnos'), + $request->input('airdates'), + $request->input('episodetitles') ); - return redirect('admin/anidb-list'); + return redirect()->to('admin/anidb-list'); break; case 'view': @@ -94,13 +95,13 @@ class AdminAnidbController extends BasePageController * * @throws \Exception */ - public function destroy(int $id): void + public function destroy(Request $request, int $id): void { $this->setAdminPrefs(); $success = false; - if (request()->has('id')) { + if ($request->has('id')) { $success = Release::removeAnidbIdFromReleases($id); $this->smarty->assign('anidbid', $id); } diff --git a/app/Http/Controllers/Admin/AdminBlacklistController.php b/app/Http/Controllers/Admin/AdminBlacklistController.php index 87ff799b2..b4ba3f6a4 100644 --- a/app/Http/Controllers/Admin/AdminBlacklistController.php +++ b/app/Http/Controllers/Admin/AdminBlacklistController.php @@ -56,7 +56,7 @@ class AdminBlacklistController extends BasePageController $binaries->updateBlacklist($request->all()); } - return redirect('admin/binaryblacklist-list'); + return redirect()->to('admin/binaryblacklist-list'); break; case 'addtest': diff --git a/app/Http/Controllers/Admin/AdminBookController.php b/app/Http/Controllers/Admin/AdminBookController.php index e29e01d89..a7c0ecf56 100644 --- a/app/Http/Controllers/Admin/AdminBookController.php +++ b/app/Http/Controllers/Admin/AdminBookController.php @@ -67,7 +67,7 @@ class AdminBookController extends BasePageController $request->merge(['publishdate' => (empty($request->input('publishdate')) || ! strtotime($request->input('publishdate'))) ? $con['publishdate'] : Carbon::parse($request->input('publishdate'))->timestamp]); $book->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('author'), $request->input('publisher'), $request->input('publishdate'), $request->input('cover')); - return redirect('admin/book-list'); + return redirect()->to('admin/book-list'); break; case 'view': default: diff --git a/app/Http/Controllers/Admin/AdminCategoryController.php b/app/Http/Controllers/Admin/AdminCategoryController.php index 72f5f464d..fbfda82d2 100644 --- a/app/Http/Controllers/Admin/AdminCategoryController.php +++ b/app/Http/Controllers/Admin/AdminCategoryController.php @@ -47,7 +47,7 @@ class AdminCategoryController extends BasePageController $request->input('maxsizetoformrelease') ); - return redirect('admin/category-list'); + return redirect()->to('admin/category-list'); break; case 'view': default: diff --git a/app/Http/Controllers/Admin/AdminCategoryRegexesController.php b/app/Http/Controllers/Admin/AdminCategoryRegexesController.php index 0b2ca2392..fc02a6a0c 100644 --- a/app/Http/Controllers/Admin/AdminCategoryRegexesController.php +++ b/app/Http/Controllers/Admin/AdminCategoryRegexesController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Admin; +use Illuminate\Http\RedirectResponse; use App\Http\Controllers\BasePageController; use App\Models\Category; use Blacklight\Regexes; @@ -41,7 +42,7 @@ class AdminCategoryRegexesController extends BasePageController * * @throws \Exception */ - public function edit(Request $request) + public function edit(Request $request): RedirectResponse { $this->setAdminPrefs(); $regexes = new Regexes(['Settings' => null, 'Table_Name' => 'category_regexes']); @@ -83,7 +84,7 @@ class AdminCategoryRegexesController extends BasePageController $regexes->updateRegex($request->all()); } - return redirect('admin/category_regexes-list'); + return redirect()->to('admin/category_regexes-list'); break; case 'view': diff --git a/app/Http/Controllers/Admin/AdminCollectionRegexesController.php b/app/Http/Controllers/Admin/AdminCollectionRegexesController.php index cdb7c768e..be5debbe6 100644 --- a/app/Http/Controllers/Admin/AdminCollectionRegexesController.php +++ b/app/Http/Controllers/Admin/AdminCollectionRegexesController.php @@ -67,7 +67,7 @@ class AdminCollectionRegexesController extends BasePageController $regexes->updateRegex($request->all()); } - return redirect('admin/collection_regexes-list'); + return redirect()->to('admin/collection_regexes-list'); break; case 'view': diff --git a/app/Http/Controllers/Admin/AdminConsoleController.php b/app/Http/Controllers/Admin/AdminConsoleController.php index 55f064bf9..e26a83f6e 100644 --- a/app/Http/Controllers/Admin/AdminConsoleController.php +++ b/app/Http/Controllers/Admin/AdminConsoleController.php @@ -69,7 +69,7 @@ class AdminConsoleController extends BasePageController $console->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('salesrank'), $request->input('platform'), $request->input('publisher'), $request->input('releasedate'), $request->input('esrb'), $request->input('cover'), $request->input('genre')); - return redirect('admin/console-list.'); + return redirect()->to('admin/console-list.'); break; case 'view': default: diff --git a/app/Http/Controllers/Admin/AdminContentController.php b/app/Http/Controllers/Admin/AdminContentController.php index da16403c4..bea646534 100644 --- a/app/Http/Controllers/Admin/AdminContentController.php +++ b/app/Http/Controllers/Admin/AdminContentController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Admin; +use Illuminate\Http\RedirectResponse; use App\Http\Controllers\BasePageController; use App\Models\User; use Blacklight\Contents; @@ -32,7 +33,7 @@ class AdminContentController extends BasePageController * * @throws \Exception */ - public function create(Request $request) + public function create(Request $request): RedirectResponse { $this->setAdminPrefs(); $contents = new Contents(); @@ -117,6 +118,6 @@ class AdminContentController extends BasePageController $referrer = $request->server('HTTP_REFERER'); - return redirect($referrer); + return redirect()->to($referrer); } } diff --git a/app/Http/Controllers/Admin/AdminGameController.php b/app/Http/Controllers/Admin/AdminGameController.php index 05efbef37..e14ec9bae 100644 --- a/app/Http/Controllers/Admin/AdminGameController.php +++ b/app/Http/Controllers/Admin/AdminGameController.php @@ -69,7 +69,7 @@ class AdminGameController extends BasePageController $games->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('publisher'), $request->input('releasedate'), $request->input('esrb'), $request->input('cover'), $request->input('trailerurl'), $request->input('genre')); - return redirect('admin/game-list'); + return redirect()->to('admin/game-list'); break; diff --git a/app/Http/Controllers/Admin/AdminGroupController.php b/app/Http/Controllers/Admin/AdminGroupController.php index 7d3241c9a..97b27303b 100644 --- a/app/Http/Controllers/Admin/AdminGroupController.php +++ b/app/Http/Controllers/Admin/AdminGroupController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Admin; +use Illuminate\Http\RedirectResponse; use App\Http\Controllers\BasePageController; use App\Models\UsenetGroup; use Illuminate\Http\Request; @@ -67,7 +68,7 @@ class AdminGroupController extends BasePageController * * @throws \Exception */ - public function edit(Request $request) + public function edit(Request $request): RedirectResponse { $this->setAdminPrefs(); @@ -100,7 +101,7 @@ class AdminGroupController extends BasePageController UsenetGroup::updateGroup($request->all()); } - return redirect('admin/group-list'); + return redirect()->to('admin/group-list'); break; case 'view': diff --git a/app/Http/Controllers/Admin/AdminMovieController.php b/app/Http/Controllers/Admin/AdminMovieController.php index 7176dff53..789abc7de 100644 --- a/app/Http/Controllers/Admin/AdminMovieController.php +++ b/app/Http/Controllers/Admin/AdminMovieController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Admin; +use Illuminate\Http\RedirectResponse; use App\Http\Controllers\BasePageController; use App\Models\MovieInfo; use App\Models\Release; @@ -35,7 +36,7 @@ class AdminMovieController extends BasePageController * * @throws \Exception */ - public function create(Request $request) + public function create(Request $request): RedirectResponse { if (! \defined('STDOUT')) { \define('STDOUT', fopen('php://stdout', 'wb')); @@ -61,13 +62,13 @@ class AdminMovieController extends BasePageController } } if (($request->has('update') && (int) $request->input('update') === 1)) { - return back()->withInput(); + return redirect()->back()->withInput(); } - return redirect('/admin/movie-list'); + return redirect()->to('/admin/movie-list'); } - return redirect('/admin/movie-list'); + return redirect()->to('/admin/movie-list'); } $content = $this->smarty->fetch('movie-add.tpl'); @@ -142,7 +143,7 @@ class AdminMovieController extends BasePageController Release::query()->where('imdbid', $id)->update(['movieinfo_id' => $movieInfo->id]); } - return redirect('admin/movie-list'); + return redirect()->to('admin/movie-list'); break; case 'view': default: diff --git a/app/Http/Controllers/Admin/AdminMusicController.php b/app/Http/Controllers/Admin/AdminMusicController.php index 1bb01fd3e..786841e69 100644 --- a/app/Http/Controllers/Admin/AdminMusicController.php +++ b/app/Http/Controllers/Admin/AdminMusicController.php @@ -68,7 +68,7 @@ class AdminMusicController extends BasePageController $music->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('salesrank'), $request->input('artist'), $request->input('publisher'), $request->input('releasedate'), $request->input('year'), $request->input('tracks'), $request->input('cover'), $request->input('genre')); - return redirect('admin/music-list'); + return redirect()->to('admin/music-list'); break; case 'view': diff --git a/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php b/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php index 22499fec6..565045506 100644 --- a/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php +++ b/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php @@ -69,7 +69,7 @@ class AdminReleaseNamingRegexesController extends BasePageController $regexes->updateRegex($request->all()); } - return redirect('admin/release_naming_regexes-list'); + return redirect()->to('admin/release_naming_regexes-list'); break; case 'view': diff --git a/app/Http/Controllers/Admin/AdminReleasesController.php b/app/Http/Controllers/Admin/AdminReleasesController.php index d2c20ff53..cf70e7f24 100644 --- a/app/Http/Controllers/Admin/AdminReleasesController.php +++ b/app/Http/Controllers/Admin/AdminReleasesController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Admin; +use Illuminate\Http\RedirectResponse; use App\Http\Controllers\BasePageController; use App\Models\Category; use App\Models\Release; @@ -34,7 +35,7 @@ class AdminReleasesController extends BasePageController * * @throws \Exception */ - public function edit(Request $request) + public function edit(Request $request): RedirectResponse { $this->setAdminPrefs(); $meta_title = $title = 'Release Edit'; diff --git a/app/Http/Controllers/Admin/AdminRoleController.php b/app/Http/Controllers/Admin/AdminRoleController.php index c27995347..abc473262 100644 --- a/app/Http/Controllers/Admin/AdminRoleController.php +++ b/app/Http/Controllers/Admin/AdminRoleController.php @@ -239,6 +239,6 @@ class AdminRoleController extends BasePageController Role::query()->where('id', $request->input('id'))->delete(); } - return redirect($request->server('HTTP_REFERER')); + return redirect()->to($request->server('HTTP_REFERER')); } } diff --git a/app/Http/Controllers/Admin/AdminSiteController.php b/app/Http/Controllers/Admin/AdminSiteController.php index 3fb4932f6..73138c404 100644 --- a/app/Http/Controllers/Admin/AdminSiteController.php +++ b/app/Http/Controllers/Admin/AdminSiteController.php @@ -57,7 +57,7 @@ class AdminSiteController extends BasePageController if ($error === '') { $site = $ret; - return redirect('admin/site-edit'); + return redirect()->to('admin/site-edit'); } $this->smarty->assign('error', $error); @@ -164,7 +164,7 @@ class AdminSiteController extends BasePageController $this->smarty->assign('themelist', Utility::getThemesList()); - if (! str_contains(env('NNTP_SERVER'), 'astra')) { + if (! str_contains(config('settings.nntp_server'), 'astra')) { $this->smarty->assign('compress_headers_warning', 'compress_headers_warning'); } @@ -199,7 +199,7 @@ class AdminSiteController extends BasePageController $usersbymonth = User::getUsersByMonth(); $this->smarty->assign('usersbymonth', $usersbymonth); - $usersbyrole = Role::query()->select(['name'])->withCount('users')->groupBy('name')->having('users_count', '>', 0)->orderBy('users_count', 'desc')->get(); + $usersbyrole = Role::query()->select(['name'])->withCount('users')->groupBy('name')->having('users_count', '>', 0)->orderByDesc('users_count')->get(); $this->smarty->assign('usersbyrole', $usersbyrole); $this->smarty->assign('totusers', 0); $this->smarty->assign('totrusers', 0); diff --git a/app/Http/Controllers/Admin/AdminUserController.php b/app/Http/Controllers/Admin/AdminUserController.php index 76feeaa3d..3fbdb8489 100644 --- a/app/Http/Controllers/Admin/AdminUserController.php +++ b/app/Http/Controllers/Admin/AdminUserController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Admin; +use Illuminate\Http\RedirectResponse; use App\Http\Controllers\BasePageController; use App\Jobs\SendAccountChangedEmail; use App\Models\Invitation; @@ -29,7 +30,7 @@ class AdminUserController extends BasePageController $ordering = getUserBrowseOrdering(); $orderBy = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : ''; - $page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1; + $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; $offset = ($page - 1) * config('nntmux.items_per_page'); $variables = [ @@ -50,7 +51,7 @@ class AdminUserController extends BasePageController true ); - $results = $this->paginate($rslt ?? [], User::getCount($variables['role'], $variables['username'], $variables['host'], $variables['email']) ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $results = $this->paginate($rslt ?? [], User::getCount($variables['role'], $variables['username'], $variables['host'], $variables['email']) ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query()); $this->smarty->assign( [ @@ -79,7 +80,7 @@ class AdminUserController extends BasePageController * * @throws \Exception */ - public function edit(Request $request) + public function edit(Request $request): RedirectResponse { $this->setAdminPrefs(); @@ -152,7 +153,7 @@ class AdminUserController extends BasePageController } if ($ret >= 0) { - return redirect('admin/user-list'); + return redirect()->to('admin/user-list'); } switch ($ret) { @@ -218,14 +219,14 @@ class AdminUserController extends BasePageController $user->delete(); - return redirect('admin/user-list'); + return redirect()->to('admin/user-list'); } if ($request->has('redir')) { - return redirect($request->input('redir')); + return redirect()->to($request->input('redir')); } - return redirect($request->server('HTTP_REFERER')); + return redirect()->to($request->server('HTTP_REFERER')); } /** diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php index f40c4d428..e18dc07a4 100644 --- a/app/Http/Controllers/Api/ApiController.php +++ b/app/Http/Controllers/Api/ApiController.php @@ -399,16 +399,16 @@ class ApiController extends BasePageController * * @return int $maxAge The maximum age of the release */ - public function maxAge(): int + public function maxAge(Request $request): int { $maxAge = -1; - if (request()->has('maxage')) { - if (! request()->filled('maxage')) { + if ($request->has('maxage')) { + if (! $request->filled('maxage')) { Utility::showApiError(201, 'Incorrect parameter (maxage must not be empty)'); - } elseif (! is_numeric(request()->input('maxage'))) { + } elseif (! is_numeric($request->input('maxage'))) { Utility::showApiError(201, 'Incorrect parameter (maxage must be numeric)'); } else { - $maxAge = (int) request()->input('maxage'); + $maxAge = (int) $request->input('maxage'); } } @@ -418,11 +418,11 @@ class ApiController extends BasePageController /** * Verify cat parameter. */ - public function categoryID(): array + public function categoryID(Request $request): array { $categoryID[] = -1; - if (request()->has('cat')) { - $categoryIDs = urldecode(request()->input('cat')); + if ($request->has('cat')) { + $categoryIDs = urldecode($request->input('cat')); // Append Web-DL category ID if HD present for SickBeard / Sonarr compatibility. if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { $categoryIDs .= (','.Category::TV_WEBDL); @@ -439,11 +439,11 @@ class ApiController extends BasePageController * * @throws \Exception */ - public function group(): string|int|bool + public function group(Request $request): string|int|bool { $groupName = -1; - if (request()->has('group')) { - $group = UsenetGroup::isValidGroup(request()->input('group')); + if ($request->has('group')) { + $group = UsenetGroup::isValidGroup($request->input('group')); if ($group !== false) { $groupName = $group; } @@ -455,11 +455,11 @@ class ApiController extends BasePageController /** * Verify limit parameter. */ - public function limit(): int + public function limit(Request $request): int { $limit = 100; - if (request()->has('limit') && is_numeric(request()->input('limit'))) { - $limit = (int) request()->input('limit'); + if ($request->has('limit') && is_numeric($request->input('limit'))) { + $limit = (int) $request->input('limit'); } return $limit; @@ -468,11 +468,11 @@ class ApiController extends BasePageController /** * Verify offset parameter. */ - public function offset(): int + public function offset(Request $request): int { $offset = 0; - if (request()->has('offset') && is_numeric(request()->input('offset'))) { - $offset = (int) request()->input('offset'); + if ($request->has('offset') && is_numeric($request->input('offset'))) { + $offset = (int) $request->input('offset'); } return $offset; @@ -481,9 +481,9 @@ class ApiController extends BasePageController /** * Check if a parameter is empty. */ - public function verifyEmptyParameter(string $parameter): void + public function verifyEmptyParameter(Request $request, string $parameter): void { - if (request()->has($parameter) && request()->isNotFilled($parameter)) { + if ($request->has($parameter) && $request->isNotFilled($parameter)) { Utility::showApiError(201, 'Incorrect parameter ('.$parameter.' must not be empty)'); } } diff --git a/app/Http/Controllers/Api/ApiV2Controller.php b/app/Http/Controllers/Api/ApiV2Controller.php index a9583bfad..66a8cd0d0 100644 --- a/app/Http/Controllers/Api/ApiV2Controller.php +++ b/app/Http/Controllers/Api/ApiV2Controller.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Api; +use Illuminate\Http\RedirectResponse; use App\Events\UserAccessedApi; use App\Http\Controllers\BasePageController; use App\Models\Category; @@ -245,7 +246,7 @@ class ApiV2Controller extends BasePageController /** * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void */ - public function getNzb(Request $request) + public function getNzb(Request $request): RedirectResponse { $user = User::query()->where('api_token', $request->input('api_token'))->first(); event(new UserAccessedApi($user)); diff --git a/app/Http/Controllers/Api/RSS.php b/app/Http/Controllers/Api/RSS.php index 9c5ce6ff6..defa94f0f 100644 --- a/app/Http/Controllers/Api/RSS.php +++ b/app/Http/Controllers/Api/RSS.php @@ -213,7 +213,7 @@ class RSS extends ApiController return DB::table($table) ->select([$column]) ->where($column, '>', 0) - ->orderBy($order, 'asc') + ->orderBy($order) ->first(); } } diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 25be84066..e208cc81f 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Auth; +use App\Http\Requests\Auth\ShowLinkRequestFormForgotPasswordRequest; use App\Http\Controllers\Controller; use App\Jobs\SendPasswordForgottenEmail; use App\Models\Settings; @@ -38,18 +39,15 @@ class ForgotPasswordController extends Controller /** * @throws \Exception */ - public function showLinkRequestForm(Request $request): void + public function showLinkRequestForm(ShowLinkRequestFormForgotPasswordRequest $request): void { $sent = ''; - $email = request()->input('email') ?? ''; - $rssToken = request()->input('apikey') ?? ''; + $email = $request->input('email') ?? ''; + $rssToken = $request->input('apikey') ?? ''; if (empty($email) && empty($rssToken)) { app('smarty.view')->assign('error', 'Missing parameter(email and/or apikey to send password reset'); } else { if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { - $this->validate($request, [ - 'g-recaptcha-response' => 'required|captcha', - ]); } // // Check users exists and send an email diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index c59d49f29..12617a26d 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers\Auth; +use Illuminate\Http\RedirectResponse; +use App\Http\Requests\Auth\LoginLoginRequest; use App\Events\UserLoggedIn; use App\Http\Controllers\Controller; use App\Models\Settings; @@ -48,12 +50,11 @@ class LoginController extends Controller } /** - * @return \Illuminate\Http\RedirectResponse|null * * @throws \Illuminate\Auth\AuthenticationException * @throws \Illuminate\Validation\ValidationException */ - public function login(Request $request) + public function login(LoginLoginRequest $request): RedirectResponse { $validator = Validator::make($request->all(), [ 'username' => ['required'], @@ -68,7 +69,7 @@ class LoginController extends Controller if ($this->hasTooManyLoginAttempts($request)) { $this->fireLockoutEvent($request); - Session::flash('message', 'You have failed to login too many times.Try again in '.$this->decayMinutes().' minutes.'); + $request->session()->flash('message', 'You have failed to login too many times.Try again in '.$this->decayMinutes().' minutes.'); return $this->showLoginForm(); } @@ -81,21 +82,18 @@ class LoginController extends Controller if ($user !== null) { if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { - $this->validate($request, [ - 'g-recaptcha-response' => ['required', 'captcha'], - ]); } $rememberMe = $request->has('rememberme') && $request->input('rememberme') === 'on'; if (! $user->isVerified() || $user->isPendingVerification()) { - Session::flash('message', 'You have not verified your email address!'); + $request->session()->flash('message', 'You have not verified your email address!'); return $this->showLoginForm(); } if (Auth::attempt($request->only($login_type, 'password'), $rememberMe)) { - $userIp = (int) Settings::settingValue('..storeuserips') === 1 ? (request()->ip() ?? request()->getClientIp()) : ''; + $userIp = (int) Settings::settingValue('..storeuserips') === 1 ? ($request->ip() ?? $request->getClientIp()) : ''; event(new UserLoggedIn($user, $userIp)); Auth::logoutOtherDevices($request->input('password')); @@ -105,17 +103,17 @@ class LoginController extends Controller } $this->incrementLoginAttempts($request); - Session::flash('message', 'Username or email and password combination used does not match our records!'); + $request->session()->flash('message', 'Username or email and password combination used does not match our records!'); } else { $this->incrementLoginAttempts($request); - Session::flash('message', 'Username or email used do not match our records!'); + $request->session()->flash('message', 'Username or email used do not match our records!'); } return $this->showLoginForm(); } $this->incrementLoginAttempts($request); - Session::flash('message', implode('', Arr::collapse($validator->errors()->toArray()))); + $request->session()->flash('message', implode('', Arr::collapse($validator->errors()->toArray()))); return $this->showLoginForm(); } @@ -139,6 +137,6 @@ class LoginController extends Controller $request->session()->flush(); $request->session()->regenerate(); - return redirect('login')->with('message', 'You have been logged out successfully'); + return redirect()->to('login')->with('message', 'You have been logged out successfully'); } } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 8269c52c1..5d0a1a945 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Auth; +use App\Http\Requests\Auth\RegisterRegisterRequest; use App\Http\Controllers\Controller; use App\Models\Invitation; use App\Models\Settings; @@ -112,7 +113,7 @@ class RegisterController extends Controller * * @throws ValidationException */ - public function register(Request $request) + public function register(RegisterRegisterRequest $request) { $error = $userName = $password = $confirmPassword = $email = $inviteCode = ''; $showRegister = 1; @@ -129,9 +130,6 @@ class RegisterController extends Controller ]); if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { - $this->validate($request, [ - 'g-recaptcha-response' => ['required', 'captcha'], - ]); } if ($validator->fails()) { @@ -170,7 +168,7 @@ class RegisterController extends Controller ); Invite::consume($inviteCode); - return $this->registered($request, $user) ?: redirect($this->redirectPath())->with('info', 'Your Account has been created. You will receive a separate verification email shortly.'); + return $this->registered($request, $user) ?: redirect()->to($this->redirectPath())->with('info', 'Your Account has been created. You will receive a separate verification email shortly.'); } break; case 'view': @@ -234,7 +232,7 @@ class RegisterController extends Controller app('smarty.view')->assign('invite_code_query', $this->inviteCodeQuery); $theme = Settings::settingValue('site.main.style'); - $nocaptcha = env('NOCAPTCHA_ENABLED'); + $nocaptcha = config('settings.nocaptcha_enabled'); $meta_title = 'Register'; $meta_keywords = 'register,signup,registration'; diff --git a/app/Http/Controllers/BasePageController.php b/app/Http/Controllers/BasePageController.php index ea398d318..92155e4b9 100644 --- a/app/Http/Controllers/BasePageController.php +++ b/app/Http/Controllers/BasePageController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers; +use Illuminate\View\View; +use Illuminate\Http\Request; use App\Events\UserLoggedIn; use App\Models\Category; use App\Models\Forumpost; @@ -107,9 +109,9 @@ class BasePageController extends Controller ); } - public function isPostBack(): bool + public function isPostBack(Request $request): bool { - return \request()->isMethod('POST'); + return $request->isMethod('POST'); } /** @@ -117,7 +119,7 @@ class BasePageController extends Controller * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function show404($message = null) + public function show404($message = null): View { if ($message !== null) { return view('errors.404')->with('Message', $message); @@ -129,7 +131,7 @@ class BasePageController extends Controller /** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function show403() + public function show403(): View { return view('errors.403'); } @@ -137,7 +139,7 @@ class BasePageController extends Controller /** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function show503() + public function show503(): View { return view('errors.503')->with('Error', 'Service temporarily unavailable'); } @@ -145,7 +147,7 @@ class BasePageController extends Controller /** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public function showBadBoy() + public function showBadBoy(): View { return view('errors.badboy')->with('Message', 'This is not you account.'); } @@ -153,7 +155,7 @@ class BasePageController extends Controller /** * Show maintenance page. */ - public function showMaintenance() + public function showMaintenance(): View { return view('errors.maintenance')->with('Message', 'We are performing an site maintenance.'); } @@ -161,15 +163,12 @@ class BasePageController extends Controller /** * Show Security token mismatch page. */ - public function showTokenError() + public function showTokenError(): View { return view('errors.tokenError')->with('Error', 'Token mismatch'); } - /** - * @param string $retry - */ - public function show429($retry = '') + public function show429(string $retry = '') { abort(429, $retry); } diff --git a/app/Http/Controllers/BrowseController.php b/app/Http/Controllers/BrowseController.php index 0193ae48a..cb2bfe900 100644 --- a/app/Http/Controllers/BrowseController.php +++ b/app/Http/Controllers/BrowseController.php @@ -12,7 +12,7 @@ class BrowseController extends BasePageController /** * @throws \Exception */ - public function index() + public function index(Request $request) { $this->setPreferences(); $releases = new Releases(); @@ -20,12 +20,12 @@ class BrowseController extends BasePageController $this->smarty->assign('category', -1); $ordering = $releases->getBrowseOrdering(); - $orderBy = request()->has('ob') && ! empty(request()->input('ob')) ? request()->input('ob') : ''; - $page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1; + $orderBy = $request->has('ob') && ! empty($request->input('ob')) ? $request->input('ob') : ''; + $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; $offset = ($page - 1) * config('nntmux.items_per_page'); $rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), $orderBy, -1, $this->userdata->categoryexclusions, -1); - $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query()); $this->smarty->assign('catname', 'All'); @@ -59,7 +59,7 @@ class BrowseController extends BasePageController /** * @throws \Exception */ - public function show(string $parentCategory, string $id = 'All'): void + public function show(Request $request, string $parentCategory, string $id = 'All'): void { $this->setPreferences(); $releases = new Releases(); @@ -83,12 +83,12 @@ class BrowseController extends BasePageController $this->smarty->assign('category', $category); $ordering = $releases->getBrowseOrdering(); - $orderBy = request()->has('ob') && ! empty(request()->input('ob')) ? request()->input('ob') : ''; - $page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1; + $orderBy = $request->has('ob') && ! empty($request->input('ob')) ? $request->input('ob') : ''; + $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; $offset = ($page - 1) * config('nntmux.items_per_page'); $rslt = $releases->getBrowseRange($page, $catarray, $offset, config('nntmux.items_per_page'), $orderBy, -1, $this->userdata->categoryexclusions, $grp); - $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query()); $browse = []; @@ -159,10 +159,10 @@ class BrowseController extends BasePageController $releases = new Releases(); if ($request->has('g')) { $group = $request->input('g'); - $page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1; + $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; $offset = ($page - 1) * config('nntmux.items_per_page'); $rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), '', -1, $this->userdata->categoryexclusions, $group); - $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query()); $browse = []; diff --git a/app/Http/Controllers/BtcPaymentController.php b/app/Http/Controllers/BtcPaymentController.php index 9f3e5cf2c..8a88b449f 100644 --- a/app/Http/Controllers/BtcPaymentController.php +++ b/app/Http/Controllers/BtcPaymentController.php @@ -15,8 +15,8 @@ class BtcPaymentController extends BasePageController public function show(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse { $this->setPreferences(); - $gateway_id = env('MYCELIUM_GATEWAY_ID'); - $gateway_secret = env('MYCELIUM_GATEWAY_SECRET'); + $gateway_id = config('settings.mycelium_gateway_id'); + $gateway_secret = config('settings.mycelium_gateway_secret'); $action = $request->input('action') ?? 'view'; $donation = Role::query()->where('donation', '>', 0)->get(['id', 'name', 'donation', 'addyears']); @@ -39,7 +39,7 @@ class BtcPaymentController extends BasePageController // Redirect to a payment gateway $url = 'https://gateway.gear.mycelium.com/pay/'.$order->payment_id; - return redirect($url); + return redirect()->to($url); } break; case 'view': @@ -63,8 +63,8 @@ class BtcPaymentController extends BasePageController */ public function callback(): void { - $gateway_id = env('MYCELIUM_GATEWAY_ID'); - $gateway_secret = env('MYCELIUM_GATEWAY_SECRET'); + $gateway_id = config('settings.mycelium_gateway_id'); + $gateway_secret = config('settings.mycelium_gateway_secret'); $geary = new Geary($gateway_id, $gateway_secret); $order = $geary->check_order_callback(); diff --git a/app/Http/Controllers/CartController.php b/app/Http/Controllers/CartController.php index 9d9f0231b..810ad907d 100644 --- a/app/Http/Controllers/CartController.php +++ b/app/Http/Controllers/CartController.php @@ -38,7 +38,7 @@ class CartController extends BasePageController $data = Release::query()->whereIn('guid', $guids)->select(['id'])->get(); if (empty($data)) { - return redirect('/cart/index'); + return redirect()->to('/cart/index'); } foreach ($data as $d) { @@ -48,7 +48,7 @@ class CartController extends BasePageController } } - return redirect('/cart/index'); + return redirect()->to('/cart/index'); } /** @@ -65,13 +65,13 @@ class CartController extends BasePageController } if (! empty($ids) && UsersRelease::delCartByGuid($ids, $this->userdata->id)) { - return redirect('/cart/index'); + return redirect()->to('/cart/index'); } if (! $id) { - return redirect('/cart/index'); + return redirect()->to('/cart/index'); } - return redirect('/cart/index'); + return redirect()->to('/cart/index'); } } diff --git a/app/Http/Controllers/ContactUsController.php b/app/Http/Controllers/ContactUsController.php index 4b63e17e5..0f8de8606 100644 --- a/app/Http/Controllers/ContactUsController.php +++ b/app/Http/Controllers/ContactUsController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Http\Requests\ContactContactURequest; use App\Jobs\SendContactUsEmail; use Illuminate\Http\Request; @@ -10,13 +11,9 @@ class ContactUsController extends BasePageController /** * @throws \Illuminate\Validation\ValidationException */ - public function contact(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|null + public function contact(ContactContactURequest $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|null { $this->setPreferences(); - $this->validate($request, [ - 'useremail' => 'required', - 'username' => 'required', - ]); if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { $this->validate($request, [ diff --git a/app/Http/Controllers/ContentController.php b/app/Http/Controllers/ContentController.php index 3d6f04c2f..274a157a4 100644 --- a/app/Http/Controllers/ContentController.php +++ b/app/Http/Controllers/ContentController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use Illuminate\Http\JsonResponse; use Blacklight\Contents; use Illuminate\Http\Request; @@ -12,7 +13,7 @@ class ContentController extends BasePageController * * @throws \Exception */ - public function show(Request $request) + public function show(Request $request): JsonResponse { $this->setPreferences(); $contents = new Contents(); diff --git a/app/Http/Controllers/DetailsController.php b/app/Http/Controllers/DetailsController.php index 2ab5a06c1..bb7e37e20 100644 --- a/app/Http/Controllers/DetailsController.php +++ b/app/Http/Controllers/DetailsController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers; +use Illuminate\Http\RedirectResponse; +use Illuminate\Http\Request; use App\Models\DnzbFailure; use App\Models\Predb; use App\Models\Release; @@ -29,7 +31,7 @@ class DetailsController extends BasePageController * * @throws \Exception */ - public function show(string $guid) + public function show(Request $request, string $guid): RedirectResponse { $this->setPreferences(); @@ -49,7 +51,7 @@ class DetailsController extends BasePageController } if ($this->isPostBack()) { - ReleaseComment::addComment($data['id'], $data['gid'], \request()->input('txtAddComment'), $this->userdata->id, \request()->ip()); + ReleaseComment::addComment($data['id'], $data['gid'], $request->input('txtAddComment'), $this->userdata->id, $request->ip()); } $nfo = ReleaseNfo::getReleaseNfo($data['id']); diff --git a/app/Http/Controllers/FailedReleasesController.php b/app/Http/Controllers/FailedReleasesController.php index b168d590b..1b6e8528a 100644 --- a/app/Http/Controllers/FailedReleasesController.php +++ b/app/Http/Controllers/FailedReleasesController.php @@ -14,12 +14,12 @@ class FailedReleasesController extends BasePageController public function failed(Request $request): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Contracts\Foundation\Application|\Illuminate\Http\Response { if ($request->missing('api_token')) { - return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => 400, 'X-DNZB-RText' => 'Bad request, please supply all parameters!']); + return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'Bad request, please supply all parameters!']); } $res = User::getByRssToken($request->input('api_token')); if ($res === null) { - return response('Unauthorised, wrong rss key!', 401)->withHeaders(['X-DNZB-RCode' => 401, 'X-DNZB-RText' => 'Unauthorised, wrong rss key!']); + return response('Unauthorised, wrong rss key!', 401)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'Unauthorised, wrong rss key!']); } $uid = $res['id']; @@ -29,12 +29,12 @@ class FailedReleasesController extends BasePageController $alt = Release::getAlternate($request->input('guid'), $uid); if (empty($alt)) { - return response('No NZB found for alternate match!', 404)->withHeaders(['X-DNZB-RCode' => 404, 'X-DNZB-RText' => 'No NZB found for alternate match.']); + return response('No NZB found for alternate match!', 404)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'No NZB found for alternate match.']); } - return response('Success', 200)->withHeaders(['Location' => url('/').'/getnzb?id='.$alt['guid'].'&r='.$rssToken]); + return response('Success')->withHeaders(['Location' => url('/').'/getnzb?id='.$alt['guid'].'&r='.$rssToken]); } - return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => 400, 'X-DNZB-RText' => 'Bad request, please supply all parameters!']); + return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'Bad request, please supply all parameters!']); } } diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index 3adff4ff0..29896d65d 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use Illuminate\Http\RedirectResponse; use App\Models\Forumpost; use App\Models\Settings; use Illuminate\Http\Request; @@ -14,13 +15,13 @@ class ForumController extends BasePageController * * @throws \Exception */ - public function forum(Request $request) + public function forum(Request $request): RedirectResponse { $this->setPreferences(); if ($this->isPostBack() && $request->has('addMessage') && $request->has('addSubject')) { Forumpost::add(0, $this->userdata->id, $request->input('addSubject'), $request->input('addMessage')); - return redirect('forum'); + return redirect()->to('forum'); } $lock = $unlock = null; @@ -36,13 +37,13 @@ class ForumController extends BasePageController if ($lock !== null) { Forumpost::lockUnlockTopic($lock, 1); - return redirect('forum'); + return redirect()->to('forum'); } if ($unlock !== null) { Forumpost::lockUnlockTopic($unlock, 0); - return redirect('forum'); + return redirect()->to('forum'); } $results = Forumpost::getBrowseRange(); @@ -68,7 +69,7 @@ class ForumController extends BasePageController * * @throws \Exception */ - public function getPosts($id, Request $request) + public function getPosts($id, Request $request): RedirectResponse { $this->setPreferences(); @@ -80,7 +81,7 @@ class ForumController extends BasePageController $results = Forumpost::getPosts($id); if (\count($results) === 0) { - return redirect('forum'); + return redirect()->to('forum'); } $meta_title = 'Forum Post'; @@ -110,10 +111,10 @@ class ForumController extends BasePageController if ($id !== null) { Forumpost::deleteParent($id); - return redirect('forum'); + return redirect()->to('forum'); } - return redirect('forum'); + return redirect()->to('forum'); } /** diff --git a/app/Http/Controllers/GamesController.php b/app/Http/Controllers/GamesController.php index ad4008b6a..0224139b9 100644 --- a/app/Http/Controllers/GamesController.php +++ b/app/Http/Controllers/GamesController.php @@ -36,7 +36,7 @@ class GamesController extends BasePageController $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; $ordering = $games->getGamesOrdering(); - $orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : ''; + $orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : ''; $offset = ($page - 1) * config('nntmux.items_per_cover_page'); $rslt = $games->getGamesRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, '', $this->userdata->categoryexclusions); $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query()); diff --git a/app/Http/Controllers/GetNzbController.php b/app/Http/Controllers/GetNzbController.php index 8b7f9e6c8..2c5776d1a 100644 --- a/app/Http/Controllers/GetNzbController.php +++ b/app/Http/Controllers/GetNzbController.php @@ -24,7 +24,7 @@ class GetNzbController extends BasePageController $this->setPreferences(); // Page is accessible only by the rss token, or logged in users. - if (Auth::check()) { + if ($request->user()) { $uid = $this->userdata->id; $maxDownloads = $this->userdata->role->downloadrequests; $rssToken = $this->userdata->api_token; diff --git a/app/Http/Controllers/MovieController.php b/app/Http/Controllers/MovieController.php index 21f6c7468..df5b3c28a 100644 --- a/app/Http/Controllers/MovieController.php +++ b/app/Http/Controllers/MovieController.php @@ -51,7 +51,7 @@ class MovieController extends BasePageController $offset = ($page - 1) * config('nntmux.items_per_cover_page'); $ordering = $movie->getMovieOrdering(); - $orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : ''; + $orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : ''; $movies = []; $rslt = $movie->getMovieRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata->categoryexclusions); diff --git a/app/Http/Controllers/MusicController.php b/app/Http/Controllers/MusicController.php index 8d35a89fc..3f578861a 100644 --- a/app/Http/Controllers/MusicController.php +++ b/app/Http/Controllers/MusicController.php @@ -48,7 +48,7 @@ class MusicController extends BasePageController $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; $offset = ($page - 1) * config('nntmux.items_per_cover_page'); $ordering = $music->getMusicOrdering(); - $orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : ''; + $orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : ''; $musics = []; $rslt = $music->getMusicRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata->categoryexclusions); diff --git a/app/Http/Controllers/MyMoviesController.php b/app/Http/Controllers/MyMoviesController.php index eea74bdec..a4d853e1f 100644 --- a/app/Http/Controllers/MyMoviesController.php +++ b/app/Http/Controllers/MyMoviesController.php @@ -32,13 +32,13 @@ class MyMoviesController extends BasePageController case 'delete': $movie = UserMovie::getMovie($this->userdata->id, $imdbid); if (! $movie) { - return redirect('/mymovies'); + return redirect()->to('/mymovies'); } UserMovie::delMovie($this->userdata->id, $imdbid); if ($request->has('from')) { header('Location:'.url($request->input('from'))); } else { - return redirect('/mymovies'); + return redirect()->to('/mymovies'); } break; @@ -46,22 +46,22 @@ class MyMoviesController extends BasePageController case 'doadd': $movie = UserMovie::getMovie($this->userdata->id, $imdbid); if ($movie) { - return redirect('/mymovies'); + return redirect()->to('/mymovies'); } $movie = $mv->getMovieInfo($imdbid); if (! $movie) { - return redirect('/mymovies'); + return redirect()->to('/mymovies'); } if ($action === 'doadd') { $category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : []; UserMovie::addMovie($this->userdata->id, $imdbid, $category); if ($request->has('from')) { - return redirect($request->input('from')); + return redirect()->to($request->input('from')); } - return redirect('/mymovies'); + return redirect()->to('/mymovies'); } $tmpcats = Category::getChildren(Category::MOVIE_ROOT); @@ -88,17 +88,17 @@ class MyMoviesController extends BasePageController $movie = UserMovie::getMovie($this->userdata->id, $imdbid); if (! $movie) { - return redirect('/mymovies'); + return redirect()->to('/mymovies'); } if ($action === 'doedit') { $category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : []; UserMovie::updateMovie($this->userdata->id, $imdbid, $category); if ($request->has('from')) { - return redirect($request->input('from')); + return redirect()->to($request->input('from')); } - return redirect('mymovies'); + return redirect()->to('mymovies'); } $tmpcats = Category::getChildren(Category::MOVIE_ROOT); diff --git a/app/Http/Controllers/MyShowsController.php b/app/Http/Controllers/MyShowsController.php index aef8a2995..f00c18e89 100644 --- a/app/Http/Controllers/MyShowsController.php +++ b/app/Http/Controllers/MyShowsController.php @@ -37,7 +37,7 @@ class MyShowsController extends BasePageController if ($request->has('from')) { header('Location:'.url($request->input('from'))); } else { - return redirect('myshows'); + return redirect()->to('myshows'); } break; @@ -45,22 +45,22 @@ class MyShowsController extends BasePageController case 'doadd': $show = UserSerie::getShow($this->userdata->id, $videoId); if ($show) { - return redirect('myshows'); + return redirect()->to('myshows'); } $show = Video::getByVideoID($videoId); if (! $show) { - return redirect('myshows'); + return redirect()->to('myshows'); } if ($action === 'doadd') { $category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : []; UserSerie::addShow($this->userdata->id, $videoId, $category); if ($request->has('from')) { - return redirect($request->input('from')); + return redirect()->to($request->input('from')); } - return redirect('myshows'); + return redirect()->to('myshows'); } $tmpcats = Category::getChildren(Category::TV_ROOT); @@ -89,17 +89,17 @@ class MyShowsController extends BasePageController $show = UserSerie::getShow($this->userdata->id, $videoId); if (! $show) { - return redirect('myshows'); + return redirect()->to('myshows'); } if ($action === 'doedit') { $category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : []; UserSerie::updateShow($this->userdata->id, $videoId, $category); if ($request->has('from')) { - return redirect($request->input('from')); + return redirect()->to($request->input('from')); } - return redirect('myshows'); + return redirect()->to('myshows'); } $tmpcats = Category::getChildren(Category::TV_ROOT); @@ -175,14 +175,14 @@ class MyShowsController extends BasePageController $releases = new Releases(); - $page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1; + $page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1; $offset = ($page - 1) * config('nntmux.items_per_page'); $ordering = $releases->getBrowseOrdering(); $orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : ''; $browseCount = $releases->getShowsCount($shows, -1, $this->userdata->categoryexclusions); $rslt = $releases->getShowsRange($shows ?? [], $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata->categoryexclusions); - $results = $this->paginate($rslt ?? [], $browseCount, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $results = $this->paginate($rslt ?? [], $browseCount, config('nntmux.items_per_page'), $page, $request->url(), $request->query()); $this->smarty->assign('covgroup', ''); diff --git a/app/Http/Controllers/PasswordSecurityController.php b/app/Http/Controllers/PasswordSecurityController.php index 46e8f9c62..8f776a3da 100644 --- a/app/Http/Controllers/PasswordSecurityController.php +++ b/app/Http/Controllers/PasswordSecurityController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Http\Requests\Disable2faPasswordSecurityRequest; use App\Models\PasswordSecurity; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -11,7 +12,7 @@ class PasswordSecurityController extends Controller { public function show2faForm(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application { - $user = Auth::user(); + $user = $request->user(); $google2fa_url = ''; if ($user->passwordSecurity()->exists()) { @@ -36,7 +37,7 @@ class PasswordSecurityController extends Controller */ public function generate2faSecret(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application { - $user = Auth::user(); + $user = $request->user(); // Add the secret key to the registration data PasswordSecurity::create( @@ -47,7 +48,7 @@ class PasswordSecurityController extends Controller ] ); - return redirect('2fa')->with('success', 'Secret Key is generated, Please verify Code to Enable 2FA'); + return redirect()->to('2fa')->with('success', 'Secret Key is generated, Please verify Code to Enable 2FA'); } /** @@ -57,33 +58,31 @@ class PasswordSecurityController extends Controller */ public function enable2fa(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application { - $user = Auth::user(); + $user = $request->user(); $secret = $request->input('verify-code'); $valid = \Google2FA::verifyKey($user->passwordSecurity->google2fa_secret, $secret); if ($valid) { $user->passwordSecurity->google2fa_enable = 1; $user->passwordSecurity->save(); - return redirect('2fa')->with('success', '2FA is Enabled Successfully.'); + return redirect()->to('2fa')->with('success', '2FA is Enabled Successfully.'); } - return redirect('2fa')->with('error', 'Invalid Verification Code, Please try again.'); + return redirect()->to('2fa')->with('error', 'Invalid Verification Code, Please try again.'); } - public function disable2fa(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application + public function disable2fa(Disable2faPasswordSecurityRequest $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application { - if (! (Hash::check($request->get('current-password'), Auth::user()->password))) { + if (! (Hash::check($request->get('current-password'), $request->user()->password))) { // The passwords matches return redirect()->back()->with('error', 'Your password does not match with your account password. Please try again.'); } - $validatedData = $request->validate([ - 'current-password' => 'required', - ]); - $user = Auth::user(); + $validatedData = $request->validated(); + $user = $request->user(); $user->passwordSecurity->google2fa_enable = 0; $user->passwordSecurity->save(); - return redirect('2fa')->with('success', '2FA is now Disabled.'); + return redirect()->to('2fa')->with('success', '2FA is now Disabled.'); } } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 1915868db..84532da49 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use Illuminate\Http\RedirectResponse; use App\Jobs\SendAccountDeletedEmail; use App\Models\ReleaseComment; use App\Models\Settings; @@ -103,7 +104,7 @@ class ProfileController extends BasePageController * * @throws \Exception */ - public function edit(Request $request) + public function edit(Request $request): RedirectResponse { $this->setPreferences(); @@ -120,9 +121,9 @@ class ProfileController extends BasePageController case 'newapikey': User::updateRssKey($userid); - return redirect('profile'); + return redirect()->to('profile'); case 'clearcookies': - return redirect('profileedit'); + return redirect()->to('profileedit'); case 'submit': $validator = Validator::make($request->all(), [ 'email' => ['nullable', 'string', 'email', 'max:255', 'unique:users', 'indisposable'], @@ -229,11 +230,11 @@ class ProfileController extends BasePageController Auth::logout(); - return redirect('login')->with('info', 'You will be able to login after you verify your new email address'); + return redirect()->to('login')->with('info', 'You will be able to login after you verify your new email address'); } } - return redirect('profile')->with('success', 'Profile changes saved'); + return redirect()->to('profile')->with('success', 'Profile changes saved'); } break; @@ -279,7 +280,7 @@ class ProfileController extends BasePageController } if ($this->userdata->hasRole('Admin')) { - return redirect('profile'); + return redirect()->to('profile'); } return view('errors.badboy')->with('warning', 'Dont try to delete another user account!'); diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index f493f49da..3d5e70fa9 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -81,7 +81,7 @@ class SearchController extends BasePageController 'basic', $categoryID); - $results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query()); $this->smarty->assign( [ @@ -155,7 +155,7 @@ class SearchController extends BasePageController [$searchVars['searchadvcat'] === '' ? -1 : $searchVars['searchadvcat']] ); - $results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query()); + $results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query()); $this->smarty->assign( [ diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index a4be5c587..eb0a808a0 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -2,17 +2,15 @@ namespace App\Http\Middleware; +use Illuminate\Http\Request; use Illuminate\Auth\Middleware\Authenticate as Middleware; class Authenticate extends Middleware { /** * Get the path the user should be redirected to when they are not authenticated. - * - * @param \Illuminate\Http\Request $request - * @return string */ - protected function redirectTo($request) + protected function redirectTo(Request $request): string { if (! $request->expectsJson()) { return route('login'); diff --git a/app/Http/Middleware/ClearanceMiddleware.php b/app/Http/Middleware/ClearanceMiddleware.php index 8fc5dbe55..95a5be662 100644 --- a/app/Http/Middleware/ClearanceMiddleware.php +++ b/app/Http/Middleware/ClearanceMiddleware.php @@ -2,6 +2,8 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; +use Illuminate\Http\Request; use Closure; use Illuminate\Support\Facades\Auth; @@ -10,14 +12,12 @@ class ClearanceMiddleware /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @return mixed * * @throws \Exception */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): Response { - $user = Auth::user(); + $user = $request->user(); if ($user->hasAnyRole(['Admin', 'Moderator']) && ! $request->is(['Admin', 'Admin/*'])) { return $next($request); diff --git a/app/Http/Middleware/Google2FAMiddleware.php b/app/Http/Middleware/Google2FAMiddleware.php index 64da0ad2b..6addcd5b0 100644 --- a/app/Http/Middleware/Google2FAMiddleware.php +++ b/app/Http/Middleware/Google2FAMiddleware.php @@ -2,6 +2,8 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; +use Illuminate\Http\Request; use App\Support\Google2FAAuthenticator; use Closure; @@ -9,11 +11,8 @@ class Google2FAMiddleware { /** * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): Response { $authenticator = app(Google2FAAuthenticator::class)->boot($request); diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 870c7c78e..746d05ec5 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,6 +2,8 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; +use Illuminate\Http\Request; use Closure; use Illuminate\Support\Facades\Auth; @@ -9,15 +11,11 @@ class RedirectIfAuthenticated { /** * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param string|null $guard - * @return mixed */ - public function handle($request, Closure $next, $guard = null) + public function handle(Request $request, Closure $next, ?string $guard = null): Response { if (Auth::guard($guard)->check()) { - return redirect('/'); + return redirect()->to('/'); } return $next($request); diff --git a/app/Http/Requests/Auth/LoginLoginRequest.php b/app/Http/Requests/Auth/LoginLoginRequest.php new file mode 100644 index 000000000..01f17813b --- /dev/null +++ b/app/Http/Requests/Auth/LoginLoginRequest.php @@ -0,0 +1,21 @@ + [ +'required', +'captcha', +], +]; + } +} diff --git a/app/Http/Requests/Auth/RegisterRegisterRequest.php b/app/Http/Requests/Auth/RegisterRegisterRequest.php new file mode 100644 index 000000000..7371a1715 --- /dev/null +++ b/app/Http/Requests/Auth/RegisterRegisterRequest.php @@ -0,0 +1,21 @@ + [ +'required', +'captcha', +], +]; + } +} diff --git a/app/Http/Requests/Auth/ShowLinkRequestFormForgotPasswordRequest.php b/app/Http/Requests/Auth/ShowLinkRequestFormForgotPasswordRequest.php new file mode 100644 index 000000000..701265753 --- /dev/null +++ b/app/Http/Requests/Auth/ShowLinkRequestFormForgotPasswordRequest.php @@ -0,0 +1,19 @@ + [ + 'required', + 'captcha', + ],]; + } +} diff --git a/app/Http/Requests/ContactContactURequest.php b/app/Http/Requests/ContactContactURequest.php new file mode 100644 index 000000000..55711c8a9 --- /dev/null +++ b/app/Http/Requests/ContactContactURequest.php @@ -0,0 +1,19 @@ + [ + 'required', + 'captcha', + ],]; + } +} diff --git a/app/Http/Requests/Disable2faPasswordSecurityRequest.php b/app/Http/Requests/Disable2faPasswordSecurityRequest.php new file mode 100644 index 000000000..90f3e6613 --- /dev/null +++ b/app/Http/Requests/Disable2faPasswordSecurityRequest.php @@ -0,0 +1,18 @@ + [ + 'required', + ],]; + } +} diff --git a/app/Jobs/RemoveInactiveAccounts.php b/app/Jobs/RemoveInactiveAccounts.php index c293586a3..61222c8eb 100644 --- a/app/Jobs/RemoveInactiveAccounts.php +++ b/app/Jobs/RemoveInactiveAccounts.php @@ -25,10 +25,8 @@ class RemoveInactiveAccounts implements ShouldQueue /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { User::query()->where('lastlogin', '<', now()->subMonths(6))->where('apiaccess', '<', now()->subMonths(6))->where('roles_id', '=', 1)->delete(); User::query()->where('lastlogin', '<', now()->subMonths(6))->whereNull('apiaccess')->where('roles_id', '=', 1)->delete(); diff --git a/app/Jobs/SendAccountChangedEmail.php b/app/Jobs/SendAccountChangedEmail.php index 8e29d55db..a30fa8244 100644 --- a/app/Jobs/SendAccountChangedEmail.php +++ b/app/Jobs/SendAccountChangedEmail.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\User; use App\Mail\AccountChange; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -21,20 +22,16 @@ class SendAccountChangedEmail implements ShouldQueue /** * Create a new job instance. - * - * @param \App\Models\User $user */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; } /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to($this->user->email)->send(new AccountChange($this->user)); } diff --git a/app/Jobs/SendAccountDeletedEmail.php b/app/Jobs/SendAccountDeletedEmail.php index cec9824d2..3e06cdd31 100644 --- a/app/Jobs/SendAccountDeletedEmail.php +++ b/app/Jobs/SendAccountDeletedEmail.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\User; use App\Mail\AccountDeleted; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -21,20 +22,16 @@ class SendAccountDeletedEmail implements ShouldQueue /** * Create a new job instance. - * - * @param \App\Models\User $user */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; } /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to(config('mail.from.address'))->send(new AccountDeleted($this->user)); } diff --git a/app/Jobs/SendAccountExpiredEmail.php b/app/Jobs/SendAccountExpiredEmail.php index c92d41035..0be956984 100644 --- a/app/Jobs/SendAccountExpiredEmail.php +++ b/app/Jobs/SendAccountExpiredEmail.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\User; use App\Mail\AccountExpired; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -21,20 +22,16 @@ class SendAccountExpiredEmail implements ShouldQueue /** * Create a new job instance. - * - * @param \App\Models\User $user */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; } /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to($this->user->email)->send(new AccountExpired($this->user)); } diff --git a/app/Jobs/SendAccountWillExpireEmail.php b/app/Jobs/SendAccountWillExpireEmail.php index 7f6651aa1..b5ba6b645 100644 --- a/app/Jobs/SendAccountWillExpireEmail.php +++ b/app/Jobs/SendAccountWillExpireEmail.php @@ -31,10 +31,8 @@ class SendAccountWillExpireEmail implements ShouldQueue /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to($this->user->email)->send(new AccountWillExpire($this->user, $this->days)); } diff --git a/app/Jobs/SendContactUsEmail.php b/app/Jobs/SendContactUsEmail.php index 07aa35749..140e9ad86 100644 --- a/app/Jobs/SendContactUsEmail.php +++ b/app/Jobs/SendContactUsEmail.php @@ -30,7 +30,7 @@ class SendContactUsEmail implements ShouldQueue $this->mailBody = $mailBody; } - public function handle() + public function handle(): void { Mail::to($this->mailTo)->send(new ContactUs($this->email, $this->mailBody)); } diff --git a/app/Jobs/SendInviteEmail.php b/app/Jobs/SendInviteEmail.php index 9a1bc40ce..a72914f39 100644 --- a/app/Jobs/SendInviteEmail.php +++ b/app/Jobs/SendInviteEmail.php @@ -37,10 +37,8 @@ class SendInviteEmail implements ShouldQueue /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to($this->email)->send(new SendInvite($this->user, $this->url)); } diff --git a/app/Jobs/SendNewRegisteredAccountMail.php b/app/Jobs/SendNewRegisteredAccountMail.php index 8c9730d2c..2ca73de2c 100644 --- a/app/Jobs/SendNewRegisteredAccountMail.php +++ b/app/Jobs/SendNewRegisteredAccountMail.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\User; use App\Mail\NewAccountCreatedEmail; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -21,20 +22,16 @@ class SendNewRegisteredAccountMail implements ShouldQueue /** * Create a new job instance. - * - * @param \App\Models\User $user */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; } /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to(config('mail.from.address'))->send(new NewAccountCreatedEmail($this->user)); } diff --git a/app/Jobs/SendPasswordForgottenEmail.php b/app/Jobs/SendPasswordForgottenEmail.php index 459e3c75e..7103e9cf4 100644 --- a/app/Jobs/SendPasswordForgottenEmail.php +++ b/app/Jobs/SendPasswordForgottenEmail.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\User; use App\Mail\ForgottenPassword; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -23,10 +24,8 @@ class SendPasswordForgottenEmail implements ShouldQueue /** * Create a new job instance. - * - * @param \App\Models\User $user */ - public function __construct($user, $resetLink) + public function __construct(User $user, $resetLink) { $this->user = $user; $this->resetLink = $resetLink; @@ -34,10 +33,8 @@ class SendPasswordForgottenEmail implements ShouldQueue /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to($this->user->email)->send(new ForgottenPassword($this->resetLink)); } diff --git a/app/Jobs/SendPasswordResetEmail.php b/app/Jobs/SendPasswordResetEmail.php index d24b73c2c..f7f3f1f15 100644 --- a/app/Jobs/SendPasswordResetEmail.php +++ b/app/Jobs/SendPasswordResetEmail.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\User; use App\Mail\PasswordReset; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -26,11 +27,8 @@ class SendPasswordResetEmail implements ShouldQueue /** * Create a new job instance. - * - * @param \App\Models\User $user - * @param string $newPass */ - public function __construct($user, $newPass) + public function __construct(User $user, string $newPass) { $this->user = $user; $this->newPass = $newPass; @@ -38,10 +36,8 @@ class SendPasswordResetEmail implements ShouldQueue /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to($this->user->email)->send(new PasswordReset($this->user, $this->newPass)); } diff --git a/app/Jobs/SendWelcomeEmail.php b/app/Jobs/SendWelcomeEmail.php index 965359419..d3ca75db5 100644 --- a/app/Jobs/SendWelcomeEmail.php +++ b/app/Jobs/SendWelcomeEmail.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\User; use App\Mail\WelcomeEmail; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -21,20 +22,16 @@ class SendWelcomeEmail implements ShouldQueue /** * Create a new job instance. - * - * @param \App\Models\User $user */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; } /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { Mail::to($this->user->email)->send(new WelcomeEmail($this->user)); } diff --git a/app/Listeners/UpdateUserAccessedApi.php b/app/Listeners/UpdateUserAccessedApi.php index 2175db2d4..5baaaf2ba 100644 --- a/app/Listeners/UpdateUserAccessedApi.php +++ b/app/Listeners/UpdateUserAccessedApi.php @@ -19,10 +19,8 @@ class UpdateUserAccessedApi /** * Handle the event. - * - * @return void */ - public function handle(UserAccessedApi $event) + public function handle(UserAccessedApi $event): void { User::find($event->user->id)->update(['apiaccess' => now()]); } diff --git a/app/Listeners/UpdateUserLoggedIn.php b/app/Listeners/UpdateUserLoggedIn.php index 1235a54ee..64d8de337 100644 --- a/app/Listeners/UpdateUserLoggedIn.php +++ b/app/Listeners/UpdateUserLoggedIn.php @@ -19,10 +19,8 @@ class UpdateUserLoggedIn /** * Handle the event. - * - * @return void */ - public function handle(UserLoggedIn $event) + public function handle(UserLoggedIn $event): void { User::find($event->user->id)->update( [ diff --git a/app/Mail/AccountChange.php b/app/Mail/AccountChange.php index 6600f5d52..58d5b7375 100644 --- a/app/Mail/AccountChange.php +++ b/app/Mail/AccountChange.php @@ -2,6 +2,7 @@ namespace App\Mail; +use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; @@ -27,10 +28,8 @@ class AccountChange extends Mailable /** * AccountChange constructor. - * - * @param \App\Models\User $user */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; $this->siteEmail = config('mail.from.address'); @@ -40,11 +39,10 @@ class AccountChange extends Mailable /** * Build the message. * - * @return $this * * @throws \Exception */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('Account Changed')->view('emails.accountChange')->with(['account' => $this->user->role->name, 'username' => $this->user->username, 'site' => $this->siteTitle]); } diff --git a/app/Mail/AccountDeleted.php b/app/Mail/AccountDeleted.php index 7f79ced8e..3b60680db 100644 --- a/app/Mail/AccountDeleted.php +++ b/app/Mail/AccountDeleted.php @@ -36,11 +36,10 @@ class AccountDeleted extends Mailable } /** - * @return $this * * @throws \Exception */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('User Account Deleted')->view('emails.accountDelete')->with(['username' => $this->user->username, 'site' => $this->siteTitle]); } diff --git a/app/Mail/AccountExpired.php b/app/Mail/AccountExpired.php index fea7aed6f..14e87b2cd 100644 --- a/app/Mail/AccountExpired.php +++ b/app/Mail/AccountExpired.php @@ -29,11 +29,10 @@ class AccountExpired extends Mailable /** * Build the message. * - * @return $this * * @throws \Exception */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('Account expired')->view('emails.accountExpired')->with(['account' => $this->user->role->name, 'username' => $this->user->username, 'site' => $this->siteTitle]); } diff --git a/app/Mail/AccountWillExpire.php b/app/Mail/AccountWillExpire.php index 6e3ecb3ea..d81899377 100644 --- a/app/Mail/AccountWillExpire.php +++ b/app/Mail/AccountWillExpire.php @@ -39,10 +39,8 @@ class AccountWillExpire extends Mailable /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('Account about to expire')->view('emails.accountAboutToExpire')->with(['account' => $this->user->role->name, 'username' => $this->user->username, 'site' => $this->siteTitle, 'days' => $this->days]); } diff --git a/app/Mail/ContactUs.php b/app/Mail/ContactUs.php index cb30b11d2..30a3b9a4a 100644 --- a/app/Mail/ContactUs.php +++ b/app/Mail/ContactUs.php @@ -26,11 +26,10 @@ class ContactUs extends Mailable /** * Build the message. * - * @return $this * * @throws \Exception */ - public function build() + public function build(): static { return $this->from($this->mailFrom)->subject('Contact form submitted')->replyTo($this->mailFrom)->view('emails.contactUs')->with(['mailBody' => $this->mailBody]); } diff --git a/app/Mail/ForgottenPassword.php b/app/Mail/ForgottenPassword.php index 3e29cc325..a9595acd8 100644 --- a/app/Mail/ForgottenPassword.php +++ b/app/Mail/ForgottenPassword.php @@ -37,11 +37,10 @@ class ForgottenPassword extends Mailable /** * Build the message. * - * @return $this * * @throws \Exception */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('Forgotten password reset')->view('emails.forgottenPassword')->with(['resetLink' => $this->resetLink, 'site' => $this->siteTitle]); } diff --git a/app/Mail/NewAccountCreatedEmail.php b/app/Mail/NewAccountCreatedEmail.php index 32c300b87..07a9bad63 100644 --- a/app/Mail/NewAccountCreatedEmail.php +++ b/app/Mail/NewAccountCreatedEmail.php @@ -39,10 +39,8 @@ class NewAccountCreatedEmail extends Mailable /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('New account registered')->view('emails.newAccountCreated')->with(['username' => $this->user->username, 'site' => $this->siteTitle]); } diff --git a/app/Mail/PasswordReset.php b/app/Mail/PasswordReset.php index b2a474821..1ead120e6 100644 --- a/app/Mail/PasswordReset.php +++ b/app/Mail/PasswordReset.php @@ -2,6 +2,7 @@ namespace App\Mail; +use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; @@ -32,10 +33,8 @@ class PasswordReset extends Mailable /** * PasswordReset constructor. - * - * @param \App\Models\User $user */ - public function __construct($user, $newPass) + public function __construct(User $user, $newPass) { $this->user = $user; $this->newPass = $newPass; @@ -46,11 +45,10 @@ class PasswordReset extends Mailable /** * Build the message. * - * @return $this * * @throws \Exception */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('Password reset')->view('emails.passwordReset')->with(['newPass' => $this->newPass, 'userName' => $this->user->username, 'site' => $this->siteTitle]); } diff --git a/app/Mail/SendInvite.php b/app/Mail/SendInvite.php index c5790bf28..2ec4bd03a 100644 --- a/app/Mail/SendInvite.php +++ b/app/Mail/SendInvite.php @@ -2,6 +2,7 @@ namespace App\Mail; +use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; @@ -32,10 +33,8 @@ class SendInvite extends Mailable /** * SendInvite constructor. - * - * @param \App\Models\User $user */ - public function __construct($user, $invite) + public function __construct(User $user, $invite) { $this->user = $user; $this->invite = $invite; @@ -46,11 +45,10 @@ class SendInvite extends Mailable /** * Build the message. * - * @return $this * * @throws \Exception */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('Invite received')->view('emails.sendinvite')->with(['invite' => $this->invite, 'username' => $this->user['username'], 'site' => $this->siteTitle, 'email' => $this->user['email']]); } diff --git a/app/Mail/WelcomeEmail.php b/app/Mail/WelcomeEmail.php index c835b154d..fa4db87a1 100644 --- a/app/Mail/WelcomeEmail.php +++ b/app/Mail/WelcomeEmail.php @@ -2,6 +2,7 @@ namespace App\Mail; +use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; @@ -27,10 +28,8 @@ class WelcomeEmail extends Mailable /** * Create a new message instance. - * - * @param \App\Models\User $user */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; $this->siteEmail = config('mail.from.address'); @@ -39,10 +38,8 @@ class WelcomeEmail extends Mailable /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->from($this->siteEmail)->subject('Welcome to '.$this->siteTitle)->view('emails.welcome')->with(['username' => $this->user->username, 'site' => $this->siteTitle]); } diff --git a/app/Models/AnidbInfo.php b/app/Models/AnidbInfo.php index 47e89ef38..9465025cd 100644 --- a/app/Models/AnidbInfo.php +++ b/app/Models/AnidbInfo.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; /** @@ -75,18 +76,12 @@ class AnidbInfo extends Model */ protected $table = 'anidb_info'; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function title() + public function title(): BelongsTo { return $this->belongsTo(AnidbTitle::class, 'anidbid'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function episode() + public function episode(): BelongsTo { return $this->belongsTo(AnidbEpisode::class, 'anidbid'); } diff --git a/app/Models/BookInfo.php b/app/Models/BookInfo.php index b6ad7e1f6..c27d2ef56 100644 --- a/app/Models/BookInfo.php +++ b/app/Models/BookInfo.php @@ -67,18 +67,12 @@ class BookInfo extends Model */ protected $guarded = []; - /** - * @return string - */ - public function searchableAs() + public function searchableAs(): string { return 'ix_bookinfo_author_title_ft'; } - /** - * @return array - */ - public function toSearchableArray() + public function toSearchableArray(): array { return [ 'author' => $this->author, diff --git a/app/Models/Category.php b/app/Models/Category.php index 67a6c7a69..b5aa2bdb1 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -251,7 +251,6 @@ class Category extends Model /** * @var string */ - protected $table = 'categories'; /** * @var bool @@ -268,18 +267,12 @@ class Category extends Model */ protected $guarded = []; - /** - * @return HasMany - */ - public function releases() + public function releases(): HasMany { return $this->hasMany(Release::class, 'categories_id'); } - /** - * @return BelongsTo - */ - public function parent() + public function parent(): BelongsTo { return $this->belongsTo(RootCategory::class, 'root_categories_id'); } @@ -301,7 +294,7 @@ class Category extends Model ->select(['root_categories_id', DB::raw('COUNT(r.id) as count'), 'title']) ->join('releases as r', 'r.categories_id', '=', 'categories.id') ->groupBy('title') - ->orderBy('count', 'desc') + ->orderByDesc('count') ->get(); Cache::put(md5('RecentlyAdded'), $result, $expiresAt); @@ -309,10 +302,7 @@ class Category extends Model return $result; } - /** - * @return string - */ - public static function getCategorySearch(array $cat = []) + public static function getCategorySearch(array $cat = []): string { $categories = []; // If multiple categories were sent in a single array position, slice and add them diff --git a/app/Models/DnzbFailure.php b/app/Models/DnzbFailure.php index bf51f3a2b..29abe8666 100644 --- a/app/Models/DnzbFailure.php +++ b/app/Models/DnzbFailure.php @@ -28,7 +28,6 @@ class DnzbFailure extends Model /** * @var string */ - protected $table = 'dnzb_failures'; /** * @var bool diff --git a/app/Models/Forumpost.php b/app/Models/Forumpost.php index 5eda05984..180f5e9c7 100644 --- a/app/Models/Forumpost.php +++ b/app/Models/Forumpost.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Database\Eloquent\Model; /** @@ -54,12 +55,7 @@ class Forumpost extends Model */ protected $guarded = []; - /** - * @param int $locked - * @param int $sticky - * @param int $replies - */ - public static function add($parentId, $userid, $subject, $message, $locked = 0, $sticky = 0, $replies = 0): int + public static function add($parentId, $userid, $subject, $message, int $locked = 0, int $sticky = 0, int $replies = 0): int { if ($message === '') { return -1; @@ -138,16 +134,15 @@ class Forumpost extends Model * * * @param $start - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ - public static function getBrowseRange() + public static function getBrowseRange(): LengthAwarePaginator { return self::query() ->where('forumpost.parentid', '=', 0) ->leftJoin('users', 'users.id', '=', 'forumpost.users_id') ->leftJoin('roles', 'roles.id', '=', 'users.roles_id') ->select(['forumpost.*', 'users.username', 'roles.name as rolename']) - ->orderBy('forumpost.updated_at', 'desc') + ->orderByDesc('forumpost.updated_at') ->paginate(config('nntmux.items_per_page')); } @@ -201,7 +196,7 @@ class Forumpost extends Model ->where('forumpost.users_id', $uid) ->select(['forumpost.*', 'users.username']) ->leftJoin('users', 'users.id', '=', 'forumpost.users_id') - ->orderBy('forumpost.created_at', 'desc'); + ->orderByDesc('forumpost.created_at'); if ($start !== false) { $range->limit($num)->offset($start); } diff --git a/app/Models/GamesInfo.php b/app/Models/GamesInfo.php index 58148a76e..9c677316b 100644 --- a/app/Models/GamesInfo.php +++ b/app/Models/GamesInfo.php @@ -65,18 +65,12 @@ class GamesInfo extends Model */ protected $guarded = []; - /** - * @return string - */ - public function searchableAs() + public function searchableAs(): string { return 'ix_title_ft'; } - /** - * @return array - */ - public function toSearchableArray() + public function toSearchableArray(): array { return [ 'title' => $this->title, diff --git a/app/Models/MusicInfo.php b/app/Models/MusicInfo.php index 744fe4019..bd65805f9 100644 --- a/app/Models/MusicInfo.php +++ b/app/Models/MusicInfo.php @@ -76,18 +76,12 @@ class MusicInfo extends Model return $this->belongsTo(Genre::class, 'genres_id'); } - /** - * @return string - */ - public function searchableAs() + public function searchableAs(): string { return 'ix_musicinfo_artist_title_ft'; } - /** - * @return array - */ - public function toSearchableArray() + public function toSearchableArray(): array { return [ 'artist' => $this->artist, diff --git a/app/Models/Predb.php b/app/Models/Predb.php index 7393c584e..c157e40b1 100644 --- a/app/Models/Predb.php +++ b/app/Models/Predb.php @@ -152,10 +152,9 @@ class Predb extends Model /** * Try to match a single release to a PreDB title when the release is created. * - * @param string $cleanerName * @return array|false Array with title/id from PreDB if found, false if not found. */ - public static function matchPre($cleanerName) + public static function matchPre(string $cleanerName) { if (empty($cleanerName)) { return false; @@ -184,12 +183,11 @@ class Predb extends Model } /** - * @param string $search * @return mixed * * @throws \Exception */ - public static function getAll($search = '') + public static function getAll(string $search = '') { $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); $predb = Cache::get(md5($search)); @@ -235,18 +233,12 @@ class Predb extends Model return self::query()->where('id', $preID)->first(); } - /** - * @return string - */ - public function searchableAs() + public function searchableAs(): string { return 'ft_predb_filename'; } - /** - * @return array - */ - public function toSearchableArray() + public function toSearchableArray(): array { return [ 'filename' => $this->filename, diff --git a/app/Models/PredbHash.php b/app/Models/PredbHash.php index f837bcccc..488795a97 100644 --- a/app/Models/PredbHash.php +++ b/app/Models/PredbHash.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; /** @@ -47,10 +48,7 @@ class PredbHash extends Model */ protected $primaryKey = 'hash'; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function predb() + public function predb(): BelongsTo { return $this->belongsTo(Predb::class, 'predb_id'); } diff --git a/app/Models/Release.php b/app/Models/Release.php index e93228da5..ad3b2ed95 100644 --- a/app/Models/Release.php +++ b/app/Models/Release.php @@ -2,6 +2,10 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Blacklight\ElasticSearchSiteSearch; use Blacklight\ManticoreSearch; use Blacklight\NZB; @@ -160,26 +164,17 @@ class Release extends Model */ protected $guarded = []; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function group() + public function group(): BelongsTo { return $this->belongsTo(UsenetGroup::class, 'groups_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function download() + public function download(): HasMany { return $this->hasMany(UserDownload::class, 'releases_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function userRelease() + public function userRelease(): HasMany { return $this->hasMany(UsersRelease::class, 'releases_id'); } @@ -189,74 +184,47 @@ class Release extends Model return $this->hasMany(ReleaseFile::class, 'releases_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function category() + public function category(): BelongsTo { return $this->belongsTo(Category::class, 'categories_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function predb() + public function predb(): BelongsTo { return $this->belongsTo(Predb::class, 'predb_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function failed() + public function failed(): HasMany { return $this->hasMany(DnzbFailure::class, 'release_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function releaseExtra() + public function releaseExtra(): HasMany { return $this->hasMany(ReleaseExtraFull::class, 'releases_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasOne - */ - public function nfo() + public function nfo(): HasOne { return $this->hasOne(ReleaseNfo::class, 'releases_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function comment() + public function comment(): HasMany { return $this->hasMany(ReleaseComment::class, 'releases_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function releaseGroup() + public function releaseGroup(): HasMany { return $this->hasMany(ReleasesGroups::class, 'releases_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function video() + public function video(): BelongsTo { return $this->belongsTo(Video::class, 'videos_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function episode() + public function episode(): BelongsTo { return $this->belongsTo(TvEpisode::class, 'tv_episodes_id'); } @@ -341,11 +309,10 @@ class Release extends Model } /** - * @param string $guid * * @throws \Exception */ - public static function updateGrab($guid): void + public static function updateGrab(string $guid): void { $updateGrabs = ((int) Settings::settingValue('..grabstatus') !== 0); if ($updateGrabs) { @@ -387,7 +354,7 @@ class Release extends Model ->selectRaw('SUM(grabs) as grabs') ->groupBy('id', 'searchname', 'adddate') ->havingRaw('SUM(grabs) > 0') - ->orderBy('grabs', 'desc') + ->orderByDesc('grabs') ->limit(10) ->get(); @@ -412,7 +379,7 @@ class Release extends Model ->selectRaw('SUM(comments) AS comments') ->groupBy('id', 'searchname', 'adddate') ->havingRaw('SUM(comments) > 0') - ->orderBy('comments', 'desc') + ->orderByDesc('comments') ->limit(10) ->get(); @@ -537,18 +504,15 @@ class Release extends Model /** * Get a range of releases. used in admin manage list. - * - * - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ - public static function getFailedRange() + public static function getFailedRange(): LengthAwarePaginator { $failedList = self::query() ->select(['name', 'searchname', 'size', 'guid', 'totalpart', 'postdate', 'adddate', 'grabs', 'cp.title as parent_category', 'c.title as sub_category', DB::raw("CONCAT(cp.title, ' > ', c.title) AS category_name")]) ->rightJoin('dnzb_failures', 'dnzb_failures.release_id', '=', 'releases.id') ->leftJoin('categories as c', 'c.id', '=', 'releases.categories_id') ->leftJoin('root_categories as cp', 'cp.id', '=', 'c.root_categories_id') - ->orderBy('postdate', 'desc'); + ->orderByDesc('postdate'); return $failedList->paginate(config('nntmux.items_per_page')); } @@ -578,7 +542,7 @@ class Release extends Model return false; } - return self::query()->leftJoin('dnzb_failures as df', 'df.release_id', '=', 'releases.id')->whereIn('releases.id', $searchResult)->where('df.release_id', '=', null)->where('releases.categories_id', $rel['categories_id'])->where('id', '<>', $rel['id'])->orderBy('releases.postdate', 'desc')->first(['guid']); + return self::query()->leftJoin('dnzb_failures as df', 'df.release_id', '=', 'releases.id')->whereIn('releases.id', $searchResult)->where('df.release_id', '=', null)->where('releases.categories_id', $rel['categories_id'])->where('id', '<>', $rel['id'])->orderByDesc('releases.postdate')->first(['guid']); } return false; diff --git a/app/Models/ReleaseComment.php b/app/Models/ReleaseComment.php index 0693412fe..230deb1ef 100644 --- a/app/Models/ReleaseComment.php +++ b/app/Models/ReleaseComment.php @@ -2,6 +2,8 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Database\Eloquent\Model; /** @@ -65,18 +67,12 @@ class ReleaseComment extends Model */ protected $dateFormat = false; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function release() + public function release(): BelongsTo { return $this->belongsTo(Release::class, 'releases_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class, 'users_id'); } @@ -92,12 +88,9 @@ class ReleaseComment extends Model return self::query()->where('id', $id)->first(); } - /** - * @return array - */ - public static function getComments($id) + public static function getComments($id): array { - return self::query()->where('releases_id', $id)->orderBy('created_at', 'desc')->get()->toArray(); + return self::query()->where('releases_id', $id)->orderByDesc('created_at')->get()->toArray(); } public static function getCommentCount(): int @@ -153,16 +146,13 @@ class ReleaseComment extends Model /** * Get release_comments rows by limit. - * - * - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ - public static function getCommentsRange() + public static function getCommentsRange(): LengthAwarePaginator { $range = self::query() ->select(['release_comments.*', 'releases.guid']) ->leftJoin('releases', 'releases.id', '=', 'release_comments.releases_id') - ->orderBy('release_comments.created_at', 'desc'); + ->orderByDesc('release_comments.created_at'); return $range->paginate(config('nntmux.items_per_page')); } @@ -186,17 +176,14 @@ class ReleaseComment extends Model return $res; } - /** - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public static function getCommentsForUserRange($uid) + public static function getCommentsForUserRange($uid): LengthAwarePaginator { return self::query() ->select(['release_comments.*', 'r.guid', 'r.searchname', 'u.username']) ->join('releases as r', 'r.id', '=', 'release_comments.releases_id') ->leftJoin('users as u', 'u.id', '=', 'release_comments.users_id') ->where('users_id', $uid) - ->orderBy('created_at', 'desc') + ->orderByDesc('created_at') ->paginate(config('nntmux.items_per_page')); } } diff --git a/app/Models/ReleaseFile.php b/app/Models/ReleaseFile.php index cc2da8e89..e8c7da7ac 100644 --- a/app/Models/ReleaseFile.php +++ b/app/Models/ReleaseFile.php @@ -85,12 +85,10 @@ class ReleaseFile extends Model * Add new files for a release ID. * * - * @param string $hash - * @param string $crc * * @throws \Exception */ - public static function addReleaseFiles($id, $name, $size, $createdTime, $hasPassword, $hash = '', $crc = ''): int + public static function addReleaseFiles($id, $name, $size, $createdTime, $hasPassword, string $hash = '', string $crc = ''): int { // Check if we already have this data in table $duplicateCheck = self::query()->where('releases_id', $id)->where('name', $name)->first(); diff --git a/app/Models/ReleaseNfo.php b/app/Models/ReleaseNfo.php index d17c3f721..5ee0feab5 100644 --- a/app/Models/ReleaseNfo.php +++ b/app/Models/ReleaseNfo.php @@ -45,10 +45,9 @@ class ReleaseNfo extends Model } /** - * @param bool $getNfoString * @return \Illuminate\Database\Eloquent\Model|null|static */ - public static function getReleaseNfo($id, $getNfoString = true) + public static function getReleaseNfo($id, bool $getNfoString = true) { $nfo = self::query()->where('releases_id', $id)->whereNotNull('nfo')->select(['releases_id']); if ($getNfoString === true) { diff --git a/app/Models/ReleaseSubtitle.php b/app/Models/ReleaseSubtitle.php index 0e7876c14..03eb81c1b 100644 --- a/app/Models/ReleaseSubtitle.php +++ b/app/Models/ReleaseSubtitle.php @@ -28,7 +28,6 @@ class ReleaseSubtitle extends Model /** * @var string */ - protected $table = 'release_subtitles'; /** * @var bool diff --git a/app/Models/ReleasesGroups.php b/app/Models/ReleasesGroups.php index f53505c5e..2c141fa47 100644 --- a/app/Models/ReleasesGroups.php +++ b/app/Models/ReleasesGroups.php @@ -43,7 +43,6 @@ class ReleasesGroups extends Model /** * @var string */ - protected $table = 'releases_groups'; /** * @var bool diff --git a/app/Models/Settings.php b/app/Models/Settings.php index 2756791eb..07229f1a3 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -93,7 +93,6 @@ class Settings extends Model /** * @var string */ - protected $table = 'settings'; /** * @var bool @@ -120,10 +119,9 @@ class Settings extends Model /** * Adapted from https://laravel.io/forum/01-15-2016-overriding-eloquent-attributes. * - * @param string $key * @return mixed */ - public function __get($key) + public function __get(string $key) { $override = self::query()->where('name', $key)->first(); @@ -145,7 +143,7 @@ class Settings extends Model * * @throws \RuntimeException */ - public static function toTree($excludeUnsectioned = true): array + public static function toTree(bool $excludeUnsectioned = true): array { $results = self::cursor()->remember(); @@ -196,7 +194,7 @@ class Settings extends Model * @return bool|null TRUE if Db version is greater than or eaqual to $requiredVersion, * false if not, and null if the version isn't available to check against. */ - public function isDbVersionAtLeast($requiredVersion): ?bool + public function isDbVersionAtLeast(string $requiredVersion): ?bool { $this->fetchDbVersion(); if (empty($this->dbVersion)) { diff --git a/app/Models/SteamApp.php b/app/Models/SteamApp.php index 811ff970a..1b1e87d79 100644 --- a/app/Models/SteamApp.php +++ b/app/Models/SteamApp.php @@ -44,18 +44,12 @@ class SteamApp extends Model */ protected $guarded = []; - /** - * @return string - */ - public function searchableAs() + public function searchableAs(): string { return 'ix_name_ft'; } - /** - * @return array - */ - public function toSearchableArray() + public function toSearchableArray(): array { return [ 'name' => $this->name, diff --git a/app/Models/TvEpisode.php b/app/Models/TvEpisode.php index 0b9076be9..0d4012dc9 100644 --- a/app/Models/TvEpisode.php +++ b/app/Models/TvEpisode.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Model; /** @@ -55,10 +56,7 @@ class TvEpisode extends Model return $this->belongsTo(Video::class, 'videos_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function release() + public function release(): HasMany { return $this->hasMany(Release::class, 'tv_episodes_id'); } diff --git a/app/Models/UsenetGroup.php b/app/Models/UsenetGroup.php index 6fc6216c8..0d3bcd42b 100644 --- a/app/Models/UsenetGroup.php +++ b/app/Models/UsenetGroup.php @@ -2,6 +2,8 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Blacklight\ColorCLI; use Blacklight\NNTP; use Blacklight\NZB; @@ -91,10 +93,7 @@ class UsenetGroup extends Model $this->allasmgr = (int) Settings::settingValue('..allasmgr') === 1; } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function release() + public function release(): HasMany { return $this->hasMany(Release::class, 'groups_id'); } @@ -149,7 +148,7 @@ class UsenetGroup extends Model return self::query()->where('backfill', '=', 1)->where('last_record', '<>', 0)->orderBy('name')->get(); break; case 'date': - return self::query()->where('backfill', '=', 1)->where('last_record', '<>', 0)->orderBy('first_record_postdate', 'DESC')->get(); + return self::query()->where('backfill', '=', 1)->where('last_record', '<>', 0)->orderByDesc('first_record_postdate')->get(); break; default: return []; @@ -197,7 +196,7 @@ class UsenetGroup extends Model * @param string $name The group name. * @return false|int false on failure, groups_id on success. */ - public static function getIDByName($name) + public static function getIDByName(string $name) { $res = self::query()->where('name', $name)->first(['id']); @@ -211,7 +210,7 @@ class UsenetGroup extends Model * @param int $active Constrain query to active status * @return mixed */ - public static function getGroupsCount($groupname = '', $active = -1) + public static function getGroupsCount(string $groupname = '', int $active = -1) { $res = self::query(); @@ -227,11 +226,9 @@ class UsenetGroup extends Model } /** - * @param string $groupname * @param null $active - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ - public static function getGroupsRange($groupname = '', $active = null) + public static function getGroupsRange(string $groupname = '', $active = null): LengthAwarePaginator { $groups = self::query()->groupBy('id')->orderBy('name'); @@ -250,11 +247,8 @@ class UsenetGroup extends Model /** * Update an existing group. - * - * - * @return int */ - public static function updateGroup($group) + public static function updateGroup($group): int { return self::query()->where('id', $group['id'])->update( [ @@ -278,7 +272,7 @@ class UsenetGroup extends Model * @param string $groupName The full name of the usenet group being evaluated * @return string|bool The name of the group replacing shorthand prefix or false if groupname was malformed */ - public static function isValidGroup($groupName) + public static function isValidGroup(string $groupName) { if (preg_match('/^([\w\-]+\.)+[\w\-]+$/i', $groupName)) { return preg_replace('/^a\.b\./i', 'alt.binaries.', $groupName, 1); @@ -418,14 +412,11 @@ class UsenetGroup extends Model /** * Adds new newsgroups based on a regular expression match against USP available. * - * @param string $groupList - * @param int $active - * @param int $backfill * @return array|string * * @throws \Exception */ - public static function addBulk($groupList, $active = 1, $backfill = 1) + public static function addBulk(string $groupList, int $active = 1, int $backfill = 1) { if (preg_match('/^\s*$/m', $groupList)) { $ret = 'No group list provided.'; @@ -477,7 +468,7 @@ class UsenetGroup extends Model * @param string $column Which column active/backfill * @param int $status Which status we are setting */ - public static function updateGroupStatus($id, $column, $status = 0): string + public static function updateGroupStatus(int $id, string $column, int $status = 0): string { self::query()->where('id', $id)->update( [ @@ -493,7 +484,7 @@ class UsenetGroup extends Model * * @param int $id The Group ID to disable */ - public static function disableIfNotExist($id): void + public static function disableIfNotExist(int $id): void { self::updateGroupStatus($id, 'active'); (new ColorCLI())->error('Group does not exist on server, disabling'); diff --git a/app/Models/User.php b/app/Models/User.php index 3cf48087f..408bbc241 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,6 +2,9 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Collection; use App\Jobs\SendAccountExpiredEmail; use App\Jobs\SendAccountWillExpireEmail; use App\Jobs\SendInviteEmail; @@ -179,7 +182,6 @@ class User extends Authenticatable /** * @var string */ - protected $table = 'users'; /** * @var bool @@ -196,66 +198,42 @@ class User extends Authenticatable */ protected $guarded = []; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function role() + public function role(): BelongsTo { return $this->belongsTo(Role::class, 'roles_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function request() + public function request(): HasMany { return $this->hasMany(UserRequest::class, 'users_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function download() + public function download(): HasMany { return $this->hasMany(UserDownload::class, 'users_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function release() + public function release(): HasMany { return $this->hasMany(UsersRelease::class, 'users_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function series() + public function series(): HasMany { return $this->hasMany(UserSerie::class, 'users_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function invitation() + public function invitation(): HasMany { return $this->hasMany(Invitation::class, 'users_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function failedRelease() + public function failedRelease(): HasMany { return $this->hasMany(DnzbFailure::class, 'users_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function comment() + public function comment(): HasMany { return $this->hasMany(ReleaseComment::class, 'users_id'); } @@ -268,13 +246,7 @@ class User extends Authenticatable self::find($id)->delete(); } - /** - * @param string $role - * @param string $username - * @param string $host - * @param string $email - */ - public static function getCount($role = '', $username = '', $host = '', $email = ''): int + public static function getCount(string $role = '', string $username = '', string $host = '', string $email = ''): int { $res = self::query()->where('email', '<>', 'sharing@nZEDb.com'); @@ -396,11 +368,10 @@ class User extends Authenticatable } /** - * @return \Illuminate\Database\Eloquent\Collection * * @throws \Throwable */ - public static function getRange($start, $offset, $orderBy, string $userName = '', ?string $email = '', ?string $host = '', ?string $role = '', bool $apiRequests = false) + public static function getRange($start, $offset, $orderBy, string $userName = '', ?string $email = '', ?string $host = '', ?string $role = '', bool $apiRequests = false): Collection { if ($apiRequests) { UserRequest::clearApiRequests(false); @@ -717,7 +688,7 @@ class User extends Authenticatable */ public static function getTopGrabbers() { - return self::query()->selectRaw('id, username, SUM(grabs) as grabs')->groupBy('id', 'username')->having('grabs', '>', 0)->orderBy('grabs', 'desc')->limit(10)->get(); + return self::query()->selectRaw('id, username, SUM(grabs) as grabs')->groupBy('id', 'username')->having('grabs', '>', 0)->orderByDesc('grabs')->limit(10)->get(); } /** @@ -725,7 +696,7 @@ class User extends Authenticatable */ public static function getUsersByMonth() { - return self::query()->whereNotNull('created_at')->where('created_at', '<>', '0000-00-00 00:00:00')->selectRaw("DATE_FORMAT(created_at, '%M %Y') as mth, COUNT(id) as num")->groupBy(['mth'])->orderBy('created_at', 'desc')->get(); + return self::query()->whereNotNull('created_at')->where('created_at', '<>', '0000-00-00 00:00:00')->selectRaw("DATE_FORMAT(created_at, '%M %Y') as mth, COUNT(id) as num")->groupBy(['mth'])->orderByDesc('created_at')->get(); } /** diff --git a/app/Models/UserDownload.php b/app/Models/UserDownload.php index 5d275620f..d9fa87d58 100644 --- a/app/Models/UserDownload.php +++ b/app/Models/UserDownload.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; /** @@ -44,18 +45,12 @@ class UserDownload extends Model */ protected $guarded = []; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class, 'users_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function release() + public function release(): BelongsTo { return $this->belongsTo(Release::class, 'releases_id'); } @@ -63,11 +58,10 @@ class UserDownload extends Model /** * Get the COUNT of how many NZB's the user has downloaded in the past day. * - * @param int $userID * * @throws \Exception */ - public static function getDownloadRequests($userID): int + public static function getDownloadRequests(int $userID): int { // Clear old requests. self::whereUsersId($userID)->where('timestamp', '<', now()->subDay())->delete(); @@ -81,7 +75,7 @@ class UserDownload extends Model */ public static function getDownloadRequestsForUser($userID) { - return self::whereUsersId($userID)->with('release')->orderBy('timestamp', 'DESC')->get(); + return self::whereUsersId($userID)->with('release')->orderByDesc('timestamp')->get(); } /** diff --git a/app/Models/UserRequest.php b/app/Models/UserRequest.php index 0408e6010..d9651ea7b 100644 --- a/app/Models/UserRequest.php +++ b/app/Models/UserRequest.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; @@ -32,7 +33,6 @@ class UserRequest extends Model /** * @var string */ - protected $table = 'user_requests'; /** * @var bool @@ -49,10 +49,7 @@ class UserRequest extends Model */ protected $fillable = ['id', 'users_id', 'request', 'hosthash', 'timestamp']; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class, 'users_id'); } @@ -70,12 +67,11 @@ class UserRequest extends Model /** * Get the quantity of API requests in the last day for the users_id. * - * @param int $userID * * @throws \Exception * @throws \Throwable */ - public static function getApiRequests($userID): int + public static function getApiRequests(int $userID): int { // Clear old requests. self::clearApiRequests($userID); @@ -90,7 +86,7 @@ class UserRequest extends Model * @param string $token API token of the user * @param string $request The API request. */ - public static function addApiRequest($token, $request): void + public static function addApiRequest(string $token, string $request): void { $userID = User::query()->select(['id'])->where('api_token', $token)->value('id'); self::query()->insert(['users_id' => $userID, 'request' => $request, 'timestamp' => now()]); diff --git a/app/Models/UserSerie.php b/app/Models/UserSerie.php index b5c3723b1..14aae0509 100644 --- a/app/Models/UserSerie.php +++ b/app/Models/UserSerie.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; /** @@ -40,10 +41,7 @@ class UserSerie extends Model */ protected $dateFormat = false; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class, 'users_id'); } diff --git a/app/Models/Video.php b/app/Models/Video.php index 588552f08..2f88a5f58 100644 --- a/app/Models/Video.php +++ b/app/Models/Video.php @@ -2,6 +2,8 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Database\Eloquent\Model; /** @@ -61,26 +63,17 @@ class Video extends Model */ public $timestamps = false; - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function alias() + public function alias(): HasMany { return $this->hasMany(VideoAlias::class, 'videos_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function release() + public function release(): HasMany { return $this->hasMany(Release::class, 'videos_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function episode() + public function episode(): HasMany { return $this->hasMany(TvEpisode::class, 'videos_id'); } @@ -102,12 +95,8 @@ class Video extends Model /** * Retrieves a range of all shows for the show-edit admin list. - * - * - * @param string $showname - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ - public static function getRange($showname = '') + public static function getRange(string $showname = ''): LengthAwarePaginator { $sql = self::query() ->select(['videos.*', 'tv_info.summary', 'tv_info.publisher', 'tv_info.image']) @@ -122,11 +111,8 @@ class Video extends Model /** * Returns a count of all shows -- usually used by pager. - * - * - * @param string $showname */ - public static function getCount($showname = ''): int + public static function getCount(string $showname = ''): int { $res = self::query()->join('tv_info', 'videos.id', '=', 'tv_info.videos_id'); @@ -139,11 +125,8 @@ class Video extends Model /** * Retrieves and returns a list of shows with eligible releases. - * - * @param string $letter - * @param string $showname */ - public static function getSeriesList($uid, $letter = '', $showname = ''): array + public static function getSeriesList($uid, string $letter = '', string $showname = ''): array { if (($letter !== '') && $letter === '0-9') { $letter = '[0-9]'; diff --git a/app/Models/VideoAlias.php b/app/Models/VideoAlias.php index be4263339..d7de9e59b 100644 --- a/app/Models/VideoAlias.php +++ b/app/Models/VideoAlias.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Model; /** @@ -34,10 +35,7 @@ class VideoAlias extends Model */ protected $guarded = []; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function video() + public function video(): BelongsTo { return $this->belongsTo(Video::class, 'videos_id'); } diff --git a/app/Observers/UserServiceObserver.php b/app/Observers/UserServiceObserver.php index 80b5409ce..4d6ae2df7 100644 --- a/app/Observers/UserServiceObserver.php +++ b/app/Observers/UserServiceObserver.php @@ -16,11 +16,10 @@ class UserServiceObserver /** * Handle the user "created" event. * - * @return void * * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException */ - public function created(User $user) + public function created(User $user): void { $roleData = Role::query()->where('id', $user->roles_id); $rateLimit = $roleData->value('rate_limit'); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a1944a89f..eedd13c58 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -9,10 +9,8 @@ class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Paginator::useBootstrap(); $smarty = app('smarty.view'); @@ -21,10 +19,8 @@ class AppServiceProvider extends ServiceProvider /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { // } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 53f92b16f..eb7a524fc 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -17,10 +17,8 @@ class AuthServiceProvider extends ServiceProvider /** * Register any authentication / authorization services. - * - * @return void */ - public function boot() + public function boot(): void { } } diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 395c518bc..2be04f5d9 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Broadcast::routes(); diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 407a10e0b..24bfb8479 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -34,10 +34,8 @@ class EventServiceProvider extends ServiceProvider /** * Register any events for your application. - * - * @return void */ - public function boot() + public function boot(): void { parent::boot(); diff --git a/app/Providers/HorizonServiceProvider.php b/app/Providers/HorizonServiceProvider.php index b13871f58..af081a8b3 100644 --- a/app/Providers/HorizonServiceProvider.php +++ b/app/Providers/HorizonServiceProvider.php @@ -10,10 +10,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { parent::boot(); @@ -26,10 +24,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider * Register the Horizon gate. * * This gate determines who can access Horizon in non-local environments. - * - * @return void */ - protected function gate() + protected function gate(): void { Gate::define('viewHorizon', function ($user) { return in_array($user->email, [ @@ -40,10 +36,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { // } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 68c30279c..9b6d8a924 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -7,23 +7,12 @@ use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { - /** - * This namespace is applied to your controller routes. - * - * In addition, it is set as the URL generator's root namespace. - * - * @var string - */ - protected $namespace = 'App\Http\Controllers'; - public const HOME = '/'; /** * Define your route model bindings, pattern filters, etc. - * - * @return void */ - public function boot() + public function boot(): void { // @@ -32,10 +21,8 @@ class RouteServiceProvider extends ServiceProvider /** * Define the routes for the application. - * - * @return void */ - public function map() + public function map(): void { $this->mapApiRoutes(); @@ -48,13 +35,10 @@ 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') - ->namespace($this->namespace) ->group(base_path('routes/web.php')); } @@ -62,14 +46,11 @@ 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') - ->namespace($this->namespace) ->group(base_path('routes/api.php')); } @@ -77,14 +58,11 @@ class RouteServiceProvider extends ServiceProvider * Define the "rss" routes for the application. * * These routes are typically stateless. - * - * @return void */ - protected function mapRssRoutes() + protected function mapRssRoutes(): void { Route::prefix('rss') ->middleware('api') - ->namespace($this->namespace) ->group(base_path('routes/rss.php')); } } diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php index f9aec8ab9..4b0b1fc10 100644 --- a/app/Providers/TelescopeServiceProvider.php +++ b/app/Providers/TelescopeServiceProvider.php @@ -11,10 +11,8 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider { /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { // Telescope::night(); @@ -34,10 +32,8 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider /** * Prevent sensitive request details from being logged by Telescope. - * - * @return void */ - protected function hideSensitiveRequestDetails() + protected function hideSensitiveRequestDetails(): void { if ($this->app->isLocal()) { return; @@ -56,10 +52,8 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider * Register the Telescope gate. * * This gate determines who can access Telescope in non-local environments. - * - * @return void */ - protected function gate() + protected function gate(): void { Gate::define('viewTelescope', function ($user) { return in_array($user->email, [ diff --git a/app/Providers/UserServiceProvider.php b/app/Providers/UserServiceProvider.php index 786b9f4df..9953756fa 100644 --- a/app/Providers/UserServiceProvider.php +++ b/app/Providers/UserServiceProvider.php @@ -10,20 +10,16 @@ class UserServiceProvider extends ServiceProvider { /** * Register services. - * - * @return void */ - public function register() + public function register(): void { // } /** * Bootstrap services. - * - * @return void */ - public function boot() + public function boot(): void { User::observe(UserServiceObserver::class); } diff --git a/config/larainvite.php b/config/larainvite.php index 41f7d9017..005fddd53 100644 --- a/config/larainvite.php +++ b/config/larainvite.php @@ -18,7 +18,7 @@ return [ | User Model |-------------------------------------------------------------------------- */ - 'UserModel' => 'App\Models\User', + 'UserModel' => App\Models\User::class, /* |-------------------------------------------------------------------------- diff --git a/config/settings.php b/config/settings.php new file mode 100644 index 000000000..2a2fbe20e --- /dev/null +++ b/config/settings.php @@ -0,0 +1,8 @@ + env('MYCELIUM_GATEWAY_ID'), + 'mycelium_gateway_secret' => env('MYCELIUM_GATEWAY_SECRET'), + 'nntp_server' => env('NNTP_SERVER'), + 'nocaptcha_enabled' => env('NOCAPTCHA_ENABLED'), +]; diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 0fa1dede8..8dd3fcdf0 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -2,6 +2,8 @@ namespace Database\Factories; +use Illuminate\Support\Str; + /* |-------------------------------------------------------------------------- | Model Factories @@ -21,6 +23,6 @@ $factory->define(App\User::class, function (Faker\Generator $faker) { 'name' => $faker->name, 'email' => $faker->unique()->safeEmail, 'password' => $password ?: $password = bcrypt('secret'), - 'remember_token' => str_random(10), + 'remember_token' => Str::random(10), ]; }); diff --git a/database/factories/ReleaseFactory.php b/database/factories/ReleaseFactory.php index a8a1b305d..833e8bc84 100644 --- a/database/factories/ReleaseFactory.php +++ b/database/factories/ReleaseFactory.php @@ -16,10 +16,8 @@ class ReleaseFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/database/migrations/2014_01_16_195548_create_users_table.php b/database/migrations/2014_01_16_195548_create_users_table.php index 0d1e578b0..2eaa6a159 100644 --- a/database/migrations/2014_01_16_195548_create_users_table.php +++ b/database/migrations/2014_01_16_195548_create_users_table.php @@ -7,10 +7,8 @@ class CreateUsersTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('users', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -50,10 +48,8 @@ class CreateUsersTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('users'); } diff --git a/database/migrations/2014_02_01_311070_create_firewall_table.php b/database/migrations/2014_02_01_311070_create_firewall_table.php index 7492c9d9c..a29e5e599 100644 --- a/database/migrations/2014_02_01_311070_create_firewall_table.php +++ b/database/migrations/2014_02_01_311070_create_firewall_table.php @@ -8,10 +8,8 @@ class CreateFirewallTable extends Migration { /** * Run the migration. - * - * @return void */ - public function up() + public function up(): void { Schema::create('firewall', function (Blueprint $table) { $table->increments('id'); @@ -26,10 +24,8 @@ class CreateFirewallTable extends Migration /** * Reverse the migration. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('firewall'); } diff --git a/database/migrations/2018_01_17_150719_create_permission_tables.php b/database/migrations/2018_01_17_150719_create_permission_tables.php index 914c270a4..a32a59093 100644 --- a/database/migrations/2018_01_17_150719_create_permission_tables.php +++ b/database/migrations/2018_01_17_150719_create_permission_tables.php @@ -8,10 +8,8 @@ class CreatePermissionTables extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { $tableNames = config('permission.table_names'); @@ -97,10 +95,8 @@ class CreatePermissionTables extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { $tableNames = config('permission.table_names'); diff --git a/database/migrations/2018_01_17_154034_create_categories_table.php b/database/migrations/2018_01_17_154034_create_categories_table.php index c715da7e6..3a63abbe5 100644 --- a/database/migrations/2018_01_17_154034_create_categories_table.php +++ b/database/migrations/2018_01_17_154034_create_categories_table.php @@ -7,10 +7,8 @@ class CreateCategoriesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('categories', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -29,10 +27,8 @@ class CreateCategoriesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('categories'); } diff --git a/database/migrations/2018_01_18_101314_create_category_regexes_table.php b/database/migrations/2018_01_18_101314_create_category_regexes_table.php index 4039da8f1..de0bd4e3c 100644 --- a/database/migrations/2018_01_18_101314_create_category_regexes_table.php +++ b/database/migrations/2018_01_18_101314_create_category_regexes_table.php @@ -7,10 +7,8 @@ class CreateCategoryRegexesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('category_regexes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -30,10 +28,8 @@ class CreateCategoryRegexesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('category_regexes'); } diff --git a/database/migrations/2018_01_18_102213_create_collection_regexes_table.php b/database/migrations/2018_01_18_102213_create_collection_regexes_table.php index 7b22893ff..1d22f504a 100644 --- a/database/migrations/2018_01_18_102213_create_collection_regexes_table.php +++ b/database/migrations/2018_01_18_102213_create_collection_regexes_table.php @@ -7,10 +7,8 @@ class CreateCollectionRegexesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('collection_regexes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -29,10 +27,8 @@ class CreateCollectionRegexesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('collection_regexes'); } diff --git a/database/migrations/2018_01_18_102716_create_binaryblacklist_table.php b/database/migrations/2018_01_18_102716_create_binaryblacklist_table.php index 193a0f34e..d459c9bd6 100644 --- a/database/migrations/2018_01_18_102716_create_binaryblacklist_table.php +++ b/database/migrations/2018_01_18_102716_create_binaryblacklist_table.php @@ -7,10 +7,8 @@ class CreateBinaryblacklistTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('binaryblacklist', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -31,10 +29,8 @@ class CreateBinaryblacklistTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('binaryblacklist'); } diff --git a/database/migrations/2018_01_18_103104_create_content_table.php b/database/migrations/2018_01_18_103104_create_content_table.php index 18a406d4e..059297387 100644 --- a/database/migrations/2018_01_18_103104_create_content_table.php +++ b/database/migrations/2018_01_18_103104_create_content_table.php @@ -7,10 +7,8 @@ class CreateContentTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('content', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -35,10 +33,8 @@ class CreateContentTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('content'); } diff --git a/database/migrations/2018_01_18_103520_create_forumpost_table.php b/database/migrations/2018_01_18_103520_create_forumpost_table.php index 8fbcc14b1..7b1741a4e 100644 --- a/database/migrations/2018_01_18_103520_create_forumpost_table.php +++ b/database/migrations/2018_01_18_103520_create_forumpost_table.php @@ -7,10 +7,8 @@ class CreateForumpostTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('forumpost', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -32,10 +30,8 @@ class CreateForumpostTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('forumpost'); } diff --git a/database/migrations/2018_01_18_103816_create_genres_table.php b/database/migrations/2018_01_18_103816_create_genres_table.php index 2d5e39ca5..4f696da18 100644 --- a/database/migrations/2018_01_18_103816_create_genres_table.php +++ b/database/migrations/2018_01_18_103816_create_genres_table.php @@ -7,10 +7,8 @@ class CreateGenresTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('genres', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -27,10 +25,8 @@ class CreateGenresTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('genres'); } diff --git a/database/migrations/2018_01_18_104345_create_usenet_groups_table.php b/database/migrations/2018_01_18_104345_create_usenet_groups_table.php index 3066c708b..1a1e16322 100644 --- a/database/migrations/2018_01_18_104345_create_usenet_groups_table.php +++ b/database/migrations/2018_01_18_104345_create_usenet_groups_table.php @@ -7,10 +7,8 @@ class CreateUsenetGroupsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('usenet_groups', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -36,10 +34,8 @@ class CreateUsenetGroupsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('groups'); } diff --git a/database/migrations/2018_01_18_105455_create_release_naming_regexes_table.php b/database/migrations/2018_01_18_105455_create_release_naming_regexes_table.php index 99e5cbeae..4849bb675 100644 --- a/database/migrations/2018_01_18_105455_create_release_naming_regexes_table.php +++ b/database/migrations/2018_01_18_105455_create_release_naming_regexes_table.php @@ -7,10 +7,8 @@ class CreateReleaseNamingRegexesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_naming_regexes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -29,10 +27,8 @@ class CreateReleaseNamingRegexesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('release_naming_regexes'); } diff --git a/database/migrations/2018_01_18_105834_create_settings_table.php b/database/migrations/2018_01_18_105834_create_settings_table.php index 1834c7ea9..c6828ed82 100644 --- a/database/migrations/2018_01_18_105834_create_settings_table.php +++ b/database/migrations/2018_01_18_105834_create_settings_table.php @@ -7,10 +7,8 @@ class CreateSettingsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('settings', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -28,10 +26,8 @@ class CreateSettingsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('settings'); } diff --git a/database/migrations/2018_01_20_195500_create_collections_table.php b/database/migrations/2018_01_20_195500_create_collections_table.php index 899edf393..8feb94d44 100644 --- a/database/migrations/2018_01_20_195500_create_collections_table.php +++ b/database/migrations/2018_01_20_195500_create_collections_table.php @@ -7,10 +7,8 @@ class CreateCollectionsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('collections', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -36,10 +34,8 @@ class CreateCollectionsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('collections'); } diff --git a/database/migrations/2018_01_20_195528_create_releases_table.php b/database/migrations/2018_01_20_195528_create_releases_table.php index 3663d35a7..93b3664da 100644 --- a/database/migrations/2018_01_20_195528_create_releases_table.php +++ b/database/migrations/2018_01_20_195528_create_releases_table.php @@ -8,10 +8,8 @@ class CreateReleasesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('releases', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -92,10 +90,8 @@ processed'); /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('releases'); } diff --git a/database/migrations/2018_01_20_195604_create_anidb_episodes_table.php b/database/migrations/2018_01_20_195604_create_anidb_episodes_table.php index ced744440..a3a949a12 100644 --- a/database/migrations/2018_01_20_195604_create_anidb_episodes_table.php +++ b/database/migrations/2018_01_20_195604_create_anidb_episodes_table.php @@ -7,10 +7,8 @@ class CreateAnidbEpisodesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('anidb_episodes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -27,10 +25,8 @@ class CreateAnidbEpisodesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('anidb_episodes'); } diff --git a/database/migrations/2018_01_20_195615_create_anidb_info_table.php b/database/migrations/2018_01_20_195615_create_anidb_info_table.php index a27247f13..18b3c8420 100644 --- a/database/migrations/2018_01_20_195615_create_anidb_info_table.php +++ b/database/migrations/2018_01_20_195615_create_anidb_info_table.php @@ -7,10 +7,8 @@ class CreateAnidbInfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('anidb_info', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -35,10 +33,8 @@ class CreateAnidbInfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('anidb_info'); } diff --git a/database/migrations/2018_01_20_195624_create_anidb_titles_table.php b/database/migrations/2018_01_20_195624_create_anidb_titles_table.php index 1a9522277..4769873ba 100644 --- a/database/migrations/2018_01_20_195624_create_anidb_titles_table.php +++ b/database/migrations/2018_01_20_195624_create_anidb_titles_table.php @@ -7,10 +7,8 @@ class CreateAnidbTitlesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('anidb_titles', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -26,10 +24,8 @@ class CreateAnidbTitlesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('anidb_titles'); } diff --git a/database/migrations/2018_01_20_195636_create_audio_data_table.php b/database/migrations/2018_01_20_195636_create_audio_data_table.php index 6dfce9700..e38fae436 100644 --- a/database/migrations/2018_01_20_195636_create_audio_data_table.php +++ b/database/migrations/2018_01_20_195636_create_audio_data_table.php @@ -7,10 +7,8 @@ class CreateAudioDataTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('audio_data', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -35,10 +33,8 @@ class CreateAudioDataTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('audio_data'); } diff --git a/database/migrations/2018_01_20_195648_create_binaries_table.php b/database/migrations/2018_01_20_195648_create_binaries_table.php index a61d7bf71..f8f3e51b9 100644 --- a/database/migrations/2018_01_20_195648_create_binaries_table.php +++ b/database/migrations/2018_01_20_195648_create_binaries_table.php @@ -7,10 +7,8 @@ class CreateBinariesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('binaries', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -32,10 +30,8 @@ class CreateBinariesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('binaries'); } diff --git a/database/migrations/2018_01_20_195703_create_bookinfo_table.php b/database/migrations/2018_01_20_195703_create_bookinfo_table.php index 81b4ca0b3..69236c7e8 100644 --- a/database/migrations/2018_01_20_195703_create_bookinfo_table.php +++ b/database/migrations/2018_01_20_195703_create_bookinfo_table.php @@ -7,10 +7,8 @@ class CreateBookinfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('bookinfo', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -37,10 +35,8 @@ class CreateBookinfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('bookinfo'); } diff --git a/database/migrations/2018_01_20_195716_create_consoleinfo_table.php b/database/migrations/2018_01_20_195716_create_consoleinfo_table.php index 5070f0ba7..1c1f902b4 100644 --- a/database/migrations/2018_01_20_195716_create_consoleinfo_table.php +++ b/database/migrations/2018_01_20_195716_create_consoleinfo_table.php @@ -7,10 +7,8 @@ class CreateConsoleinfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('consoleinfo', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -35,10 +33,8 @@ class CreateConsoleinfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('consoleinfo'); } diff --git a/database/migrations/2018_01_20_195728_create_dnzb_failures_table.php b/database/migrations/2018_01_20_195728_create_dnzb_failures_table.php index d2c1e2773..5cc1f2157 100644 --- a/database/migrations/2018_01_20_195728_create_dnzb_failures_table.php +++ b/database/migrations/2018_01_20_195728_create_dnzb_failures_table.php @@ -7,10 +7,8 @@ class CreateDnzbFailuresTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('dnzb_failures', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -27,10 +25,8 @@ class CreateDnzbFailuresTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('dnzb_failures'); } diff --git a/database/migrations/2018_01_20_195739_create_gamesinfo_table.php b/database/migrations/2018_01_20_195739_create_gamesinfo_table.php index 5293cf497..3f98aae24 100644 --- a/database/migrations/2018_01_20_195739_create_gamesinfo_table.php +++ b/database/migrations/2018_01_20_195739_create_gamesinfo_table.php @@ -7,10 +7,8 @@ class CreateGamesinfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('gamesinfo', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -36,10 +34,8 @@ class CreateGamesinfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('gamesinfo'); } diff --git a/database/migrations/2018_01_20_195752_create_invitations_table.php b/database/migrations/2018_01_20_195752_create_invitations_table.php index 3c29e73e9..2fc446420 100644 --- a/database/migrations/2018_01_20_195752_create_invitations_table.php +++ b/database/migrations/2018_01_20_195752_create_invitations_table.php @@ -7,10 +7,8 @@ class CreateInvitationsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('invitations', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -26,10 +24,8 @@ class CreateInvitationsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('invitations'); } diff --git a/database/migrations/2018_01_20_195801_create_logging_table.php b/database/migrations/2018_01_20_195801_create_logging_table.php index 3e1f0c7bf..1a4e475c3 100644 --- a/database/migrations/2018_01_20_195801_create_logging_table.php +++ b/database/migrations/2018_01_20_195801_create_logging_table.php @@ -7,10 +7,8 @@ class CreateLoggingTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('logging', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -25,10 +23,8 @@ class CreateLoggingTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('logging'); } diff --git a/database/migrations/2018_01_20_195812_create_missed_parts_table.php b/database/migrations/2018_01_20_195812_create_missed_parts_table.php index ce80acdb2..a9ca07da0 100644 --- a/database/migrations/2018_01_20_195812_create_missed_parts_table.php +++ b/database/migrations/2018_01_20_195812_create_missed_parts_table.php @@ -7,10 +7,8 @@ class CreateMissedPartsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('missed_parts', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -28,10 +26,8 @@ class CreateMissedPartsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('missed_parts'); } diff --git a/database/migrations/2018_01_20_195822_create_movieinfo_table.php b/database/migrations/2018_01_20_195822_create_movieinfo_table.php index c86b34731..3433b6f60 100644 --- a/database/migrations/2018_01_20_195822_create_movieinfo_table.php +++ b/database/migrations/2018_01_20_195822_create_movieinfo_table.php @@ -7,10 +7,8 @@ class CreateMovieinfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('movieinfo', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -40,10 +38,8 @@ class CreateMovieinfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('movieinfo'); } diff --git a/database/migrations/2018_01_20_195832_create_musicinfo_table.php b/database/migrations/2018_01_20_195832_create_musicinfo_table.php index d7face55e..33e941fcc 100644 --- a/database/migrations/2018_01_20_195832_create_musicinfo_table.php +++ b/database/migrations/2018_01_20_195832_create_musicinfo_table.php @@ -7,10 +7,8 @@ class CreateMusicinfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('musicinfo', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -36,10 +34,8 @@ class CreateMusicinfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('musicinfo'); } diff --git a/database/migrations/2018_01_20_195915_create_par_hashes_table.php b/database/migrations/2018_01_20_195915_create_par_hashes_table.php index 6f86295a6..c46df32b7 100644 --- a/database/migrations/2018_01_20_195915_create_par_hashes_table.php +++ b/database/migrations/2018_01_20_195915_create_par_hashes_table.php @@ -7,10 +7,8 @@ class CreateParHashesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('par_hashes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -25,10 +23,8 @@ class CreateParHashesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('par_hashes'); } diff --git a/database/migrations/2018_01_20_195925_create_parts_table.php b/database/migrations/2018_01_20_195925_create_parts_table.php index 5e18588d4..837993742 100644 --- a/database/migrations/2018_01_20_195925_create_parts_table.php +++ b/database/migrations/2018_01_20_195925_create_parts_table.php @@ -7,10 +7,8 @@ class CreatePartsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('parts', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -28,10 +26,8 @@ class CreatePartsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('parts'); } diff --git a/database/migrations/2018_01_20_195934_create_predb_table.php b/database/migrations/2018_01_20_195934_create_predb_table.php index 6c5ac0e49..50267e379 100644 --- a/database/migrations/2018_01_20_195934_create_predb_table.php +++ b/database/migrations/2018_01_20_195934_create_predb_table.php @@ -8,10 +8,8 @@ class CreatePredbTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('predb', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -47,10 +45,8 @@ class CreatePredbTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('predb'); } diff --git a/database/migrations/2018_01_20_195946_create_predb_hashes_table.php b/database/migrations/2018_01_20_195946_create_predb_hashes_table.php index 2223d56f9..130b10fe3 100644 --- a/database/migrations/2018_01_20_195946_create_predb_hashes_table.php +++ b/database/migrations/2018_01_20_195946_create_predb_hashes_table.php @@ -7,10 +7,8 @@ class CreatePredbHashesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('predb_hashes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -25,10 +23,8 @@ class CreatePredbHashesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('predb_hashes'); } diff --git a/database/migrations/2018_01_20_195954_create_predb_imports_table.php b/database/migrations/2018_01_20_195954_create_predb_imports_table.php index 8a977945d..747386e09 100644 --- a/database/migrations/2018_01_20_195954_create_predb_imports_table.php +++ b/database/migrations/2018_01_20_195954_create_predb_imports_table.php @@ -7,10 +7,8 @@ class CreatePredbImportsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('predb_imports', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -35,10 +33,8 @@ class CreatePredbImportsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('predb_imports'); } diff --git a/database/migrations/2018_01_20_200005_create_release_comments_table.php b/database/migrations/2018_01_20_200005_create_release_comments_table.php index 10b2fd772..be4a8bdec 100644 --- a/database/migrations/2018_01_20_200005_create_release_comments_table.php +++ b/database/migrations/2018_01_20_200005_create_release_comments_table.php @@ -7,10 +7,8 @@ class CreateReleaseCommentsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_comments', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -41,10 +39,8 @@ class CreateReleaseCommentsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('release_comments'); } diff --git a/database/migrations/2018_01_20_200018_create_releases_groups_table.php b/database/migrations/2018_01_20_200018_create_releases_groups_table.php index 4edf10e54..dcdc2dac3 100644 --- a/database/migrations/2018_01_20_200018_create_releases_groups_table.php +++ b/database/migrations/2018_01_20_200018_create_releases_groups_table.php @@ -7,10 +7,8 @@ class CreateReleasesGroupsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('releases_groups', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -25,10 +23,8 @@ class CreateReleasesGroupsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('releases_groups'); } diff --git a/database/migrations/2018_01_20_200030_create_release_regexes_table.php b/database/migrations/2018_01_20_200030_create_release_regexes_table.php index 7a3d2eb49..e7caa8ffd 100644 --- a/database/migrations/2018_01_20_200030_create_release_regexes_table.php +++ b/database/migrations/2018_01_20_200030_create_release_regexes_table.php @@ -7,10 +7,8 @@ class CreateReleaseRegexesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_regexes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -25,10 +23,8 @@ class CreateReleaseRegexesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('release_regexes'); } diff --git a/database/migrations/2018_01_20_200038_create_release_unique_table.php b/database/migrations/2018_01_20_200038_create_release_unique_table.php index ca8fe3ff5..0581b0c47 100644 --- a/database/migrations/2018_01_20_200038_create_release_unique_table.php +++ b/database/migrations/2018_01_20_200038_create_release_unique_table.php @@ -7,10 +7,8 @@ class CreateReleaseUniqueTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_unique', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -25,10 +23,8 @@ class CreateReleaseUniqueTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('release_unique'); } diff --git a/database/migrations/2018_01_20_200046_create_releaseextrafull_table.php b/database/migrations/2018_01_20_200046_create_releaseextrafull_table.php index 2012d4c28..58c625b16 100644 --- a/database/migrations/2018_01_20_200046_create_releaseextrafull_table.php +++ b/database/migrations/2018_01_20_200046_create_releaseextrafull_table.php @@ -7,10 +7,8 @@ class CreateReleaseextrafullTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('releaseextrafull', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -24,10 +22,8 @@ class CreateReleaseextrafullTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('releaseextrafull'); } diff --git a/database/migrations/2018_01_20_200056_create_release_files_table.php b/database/migrations/2018_01_20_200056_create_release_files_table.php index e69903b5a..122a33cac 100644 --- a/database/migrations/2018_01_20_200056_create_release_files_table.php +++ b/database/migrations/2018_01_20_200056_create_release_files_table.php @@ -8,10 +8,8 @@ class CreateReleaseFilesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_files', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -39,10 +37,8 @@ class CreateReleaseFilesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('release_files'); } diff --git a/database/migrations/2018_01_20_200104_create_release_nfos_table.php b/database/migrations/2018_01_20_200104_create_release_nfos_table.php index d3919f7ba..573d8d90c 100644 --- a/database/migrations/2018_01_20_200104_create_release_nfos_table.php +++ b/database/migrations/2018_01_20_200104_create_release_nfos_table.php @@ -7,10 +7,8 @@ class CreateReleaseNfosTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_nfos', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -24,10 +22,8 @@ class CreateReleaseNfosTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('release_nfos'); } diff --git a/database/migrations/2018_01_20_200124_create_release_subtitles_table.php b/database/migrations/2018_01_20_200124_create_release_subtitles_table.php index 974b7bf79..71675aa63 100644 --- a/database/migrations/2018_01_20_200124_create_release_subtitles_table.php +++ b/database/migrations/2018_01_20_200124_create_release_subtitles_table.php @@ -7,10 +7,8 @@ class CreateReleaseSubtitlesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_subtitles', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -27,10 +25,8 @@ class CreateReleaseSubtitlesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('release_subtitles'); } diff --git a/database/migrations/2018_01_20_200151_create_short_groups_table.php b/database/migrations/2018_01_20_200151_create_short_groups_table.php index 89ebdc502..4ce760424 100644 --- a/database/migrations/2018_01_20_200151_create_short_groups_table.php +++ b/database/migrations/2018_01_20_200151_create_short_groups_table.php @@ -7,10 +7,8 @@ class CreateShortGroupsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('short_groups', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -26,10 +24,8 @@ class CreateShortGroupsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('short_groups'); } diff --git a/database/migrations/2018_01_20_200200_create_steam_apps_table.php b/database/migrations/2018_01_20_200200_create_steam_apps_table.php index ac5f9dc44..f34cbb22d 100644 --- a/database/migrations/2018_01_20_200200_create_steam_apps_table.php +++ b/database/migrations/2018_01_20_200200_create_steam_apps_table.php @@ -7,10 +7,8 @@ class CreateSteamAppsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('steam_apps', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -25,10 +23,8 @@ class CreateSteamAppsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('steam_apps'); } diff --git a/database/migrations/2018_01_20_200211_create_tv_episodes_table.php b/database/migrations/2018_01_20_200211_create_tv_episodes_table.php index e22e0a27c..f785f4b46 100644 --- a/database/migrations/2018_01_20_200211_create_tv_episodes_table.php +++ b/database/migrations/2018_01_20_200211_create_tv_episodes_table.php @@ -7,10 +7,8 @@ class CreateTvEpisodesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('tv_episodes', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -30,10 +28,8 @@ class CreateTvEpisodesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('tv_episodes'); } diff --git a/database/migrations/2018_01_20_200218_create_tv_info_table.php b/database/migrations/2018_01_20_200218_create_tv_info_table.php index 6252bd3c0..1b475aa9e 100644 --- a/database/migrations/2018_01_20_200218_create_tv_info_table.php +++ b/database/migrations/2018_01_20_200218_create_tv_info_table.php @@ -7,10 +7,8 @@ class CreateTvInfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('tv_info', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -26,10 +24,8 @@ class CreateTvInfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('tv_info'); } diff --git a/database/migrations/2018_01_20_200237_create_users_releases_table.php b/database/migrations/2018_01_20_200237_create_users_releases_table.php index 9fb68c263..23bacff25 100644 --- a/database/migrations/2018_01_20_200237_create_users_releases_table.php +++ b/database/migrations/2018_01_20_200237_create_users_releases_table.php @@ -7,10 +7,8 @@ class CreateUsersReleasesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('users_releases', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -28,10 +26,8 @@ class CreateUsersReleasesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('users_releases'); } diff --git a/database/migrations/2018_01_20_200248_create_user_downloads_table.php b/database/migrations/2018_01_20_200248_create_user_downloads_table.php index 56a45ff52..81a0215b5 100644 --- a/database/migrations/2018_01_20_200248_create_user_downloads_table.php +++ b/database/migrations/2018_01_20_200248_create_user_downloads_table.php @@ -7,10 +7,8 @@ class CreateUserDownloadsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('user_downloads', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -27,10 +25,8 @@ class CreateUserDownloadsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('user_downloads'); } diff --git a/database/migrations/2018_01_20_200318_create_user_movies_table.php b/database/migrations/2018_01_20_200318_create_user_movies_table.php index 6c2bec9c5..292c2ff85 100644 --- a/database/migrations/2018_01_20_200318_create_user_movies_table.php +++ b/database/migrations/2018_01_20_200318_create_user_movies_table.php @@ -7,10 +7,8 @@ class CreateUserMoviesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('user_movies', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -28,10 +26,8 @@ class CreateUserMoviesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('user_movies'); } diff --git a/database/migrations/2018_01_20_200328_create_user_requests_table.php b/database/migrations/2018_01_20_200328_create_user_requests_table.php index d6b3a43cf..c3c4215ed 100644 --- a/database/migrations/2018_01_20_200328_create_user_requests_table.php +++ b/database/migrations/2018_01_20_200328_create_user_requests_table.php @@ -7,10 +7,8 @@ class CreateUserRequestsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('user_requests', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -27,10 +25,8 @@ class CreateUserRequestsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('user_requests'); } diff --git a/database/migrations/2018_01_20_200336_create_user_series_table.php b/database/migrations/2018_01_20_200336_create_user_series_table.php index 8f0b84f26..6cba8008f 100644 --- a/database/migrations/2018_01_20_200336_create_user_series_table.php +++ b/database/migrations/2018_01_20_200336_create_user_series_table.php @@ -7,10 +7,8 @@ class CreateUserSeriesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('user_series', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -28,10 +26,8 @@ class CreateUserSeriesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('user_series'); } diff --git a/database/migrations/2018_01_20_200346_create_video_data_table.php b/database/migrations/2018_01_20_200346_create_video_data_table.php index 4c0ac7e5e..9505c7cd2 100644 --- a/database/migrations/2018_01_20_200346_create_video_data_table.php +++ b/database/migrations/2018_01_20_200346_create_video_data_table.php @@ -7,10 +7,8 @@ class CreateVideoDataTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('video_data', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -33,10 +31,8 @@ class CreateVideoDataTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('video_data'); } diff --git a/database/migrations/2018_01_20_200353_create_videos_table.php b/database/migrations/2018_01_20_200353_create_videos_table.php index ecb6102a1..ac95ea8ad 100644 --- a/database/migrations/2018_01_20_200353_create_videos_table.php +++ b/database/migrations/2018_01_20_200353_create_videos_table.php @@ -7,10 +7,8 @@ class CreateVideosTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('videos', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -36,10 +34,8 @@ class CreateVideosTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('videos'); } diff --git a/database/migrations/2018_01_20_200403_create_videos_aliases_table.php b/database/migrations/2018_01_20_200403_create_videos_aliases_table.php index bb84f1cf8..f5910370d 100644 --- a/database/migrations/2018_01_20_200403_create_videos_aliases_table.php +++ b/database/migrations/2018_01_20_200403_create_videos_aliases_table.php @@ -7,10 +7,8 @@ class CreateVideosAliasesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('videos_aliases', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -24,10 +22,8 @@ class CreateVideosAliasesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('videos_aliases'); } diff --git a/database/migrations/2018_01_20_200417_create_xxxinfo_table.php b/database/migrations/2018_01_20_200417_create_xxxinfo_table.php index bcb71bcf0..b4deadaf0 100644 --- a/database/migrations/2018_01_20_200417_create_xxxinfo_table.php +++ b/database/migrations/2018_01_20_200417_create_xxxinfo_table.php @@ -7,10 +7,8 @@ class CreateXxxinfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('xxxinfo', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -36,10 +34,8 @@ class CreateXxxinfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('xxxinfo'); } diff --git a/database/migrations/2018_01_22_220858_add_stored_procedures.php b/database/migrations/2018_01_22_220858_add_stored_procedures.php index e56d70961..0a954f7fa 100644 --- a/database/migrations/2018_01_22_220858_add_stored_procedures.php +++ b/database/migrations/2018_01_22_220858_add_stored_procedures.php @@ -6,10 +6,8 @@ class AddStoredProcedures extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { DB::unprepared('DROP PROCEDURE IF EXISTS loop_cbpm; DROP PROCEDURE IF EXISTS delete_release; CREATE PROCEDURE loop_cbpm(IN method CHAR(10)) COMMENT "Performs tasks on All CBPM tables one by one -- REPAIR/ANALYZE/OPTIMIZE or DROP/TRUNCATE" @@ -52,10 +50,8 @@ class AddStoredProcedures extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { DB::statement('DROP PROCEDURE loop_cbpm;'); } diff --git a/database/migrations/2018_04_24_132758_create_cache_table.php b/database/migrations/2018_04_24_132758_create_cache_table.php index 7b73e5fd1..a90f4b4ee 100644 --- a/database/migrations/2018_04_24_132758_create_cache_table.php +++ b/database/migrations/2018_04_24_132758_create_cache_table.php @@ -8,10 +8,8 @@ class CreateCacheTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('cache', function (Blueprint $table) { $table->string('key')->unique(); @@ -22,10 +20,8 @@ class CreateCacheTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('cache'); } diff --git a/database/migrations/2018_08_08_100000_create_telescope_entries_table.php b/database/migrations/2018_08_08_100000_create_telescope_entries_table.php index 90bb77fde..574e04575 100644 --- a/database/migrations/2018_08_08_100000_create_telescope_entries_table.php +++ b/database/migrations/2018_08_08_100000_create_telescope_entries_table.php @@ -27,10 +27,8 @@ class CreateTelescopeEntriesTable extends Migration /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { $this->schema->create('telescope_entries', function (Blueprint $table) { $table->bigIncrements('sequence'); @@ -67,10 +65,8 @@ class CreateTelescopeEntriesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { $this->schema->dropIfExists('telescope_entries_tags'); $this->schema->dropIfExists('telescope_entries'); diff --git a/database/migrations/2018_09_13_070520_add_verification_to_user_table.php b/database/migrations/2018_09_13_070520_add_verification_to_user_table.php index aae68089a..d76de733b 100644 --- a/database/migrations/2018_09_13_070520_add_verification_to_user_table.php +++ b/database/migrations/2018_09_13_070520_add_verification_to_user_table.php @@ -11,10 +11,8 @@ class AddVerificationToUserTable extends Migration { /** * Determine the user table name. - * - * @return string */ - public function getUserTableName() + public function getUserTableName(): string { $user_model = config('auth.providers.users.model', App\Models\User::class); @@ -23,10 +21,8 @@ class AddVerificationToUserTable extends Migration /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table($this->getUserTableName(), function (Blueprint $table) { $table->boolean('verified')->default(false); @@ -36,10 +32,8 @@ class AddVerificationToUserTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table($this->getUserTableName(), function (Blueprint $table) { $table->dropColumn('verified'); diff --git a/database/migrations/2019_02_20_102034_create_failed_jobs_table.php b/database/migrations/2019_02_20_102034_create_failed_jobs_table.php index 9bddee36c..67cc14e5a 100644 --- a/database/migrations/2019_02_20_102034_create_failed_jobs_table.php +++ b/database/migrations/2019_02_20_102034_create_failed_jobs_table.php @@ -8,10 +8,8 @@ class CreateFailedJobsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); @@ -25,10 +23,8 @@ class CreateFailedJobsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/database/migrations/2019_03_11_234818_create_root_categories_table.php b/database/migrations/2019_03_11_234818_create_root_categories_table.php index 7727e045b..1a60a7640 100644 --- a/database/migrations/2019_03_11_234818_create_root_categories_table.php +++ b/database/migrations/2019_03_11_234818_create_root_categories_table.php @@ -8,10 +8,8 @@ class CreateRootCategoriesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('root_categories', function (Blueprint $table) { $table->engine = 'InnoDB'; @@ -27,10 +25,8 @@ class CreateRootCategoriesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('root_categories'); } diff --git a/database/migrations/2019_03_12_090532_change_categories_table.php b/database/migrations/2019_03_12_090532_change_categories_table.php index 4510d466a..474d76bcc 100644 --- a/database/migrations/2019_03_12_090532_change_categories_table.php +++ b/database/migrations/2019_03_12_090532_change_categories_table.php @@ -8,10 +8,8 @@ class ChangeCategoriesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('categories', function (Blueprint $table) { $table->bigInteger('parentid')->unsigned()->change(); @@ -20,10 +18,8 @@ class ChangeCategoriesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('categories', function (Blueprint $table) { $table->integer('parentid'); diff --git a/database/migrations/2019_03_12_093837_add_foreign_categories_table.php b/database/migrations/2019_03_12_093837_add_foreign_categories_table.php index 9a39ef4dc..27879a5ef 100644 --- a/database/migrations/2019_03_12_093837_add_foreign_categories_table.php +++ b/database/migrations/2019_03_12_093837_add_foreign_categories_table.php @@ -8,10 +8,8 @@ class AddForeignCategoriesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); Schema::table('categories', function (Blueprint $table) { @@ -23,10 +21,8 @@ class AddForeignCategoriesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::disableForeignKeyConstraints(); Schema::table('categories', function (Blueprint $table) { diff --git a/database/migrations/2019_04_04_130055_update_releases_table.php b/database/migrations/2019_04_04_130055_update_releases_table.php index c2652c7f4..6edf9f6d1 100644 --- a/database/migrations/2019_04_04_130055_update_releases_table.php +++ b/database/migrations/2019_04_04_130055_update_releases_table.php @@ -8,10 +8,8 @@ class UpdateReleasesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('releases', function (Blueprint $table) { $table->string('imdbid', 100)->nullable()->change(); @@ -20,10 +18,8 @@ class UpdateReleasesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('releases', function (Blueprint $table) { $table->unsignedMediumInteger('imdbid')->nullable()->change(); diff --git a/database/migrations/2019_04_04_150842_update_movieinfo_table.php b/database/migrations/2019_04_04_150842_update_movieinfo_table.php index a7e528644..ce12ef97b 100644 --- a/database/migrations/2019_04_04_150842_update_movieinfo_table.php +++ b/database/migrations/2019_04_04_150842_update_movieinfo_table.php @@ -8,10 +8,8 @@ class UpdateMovieinfoTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('movieinfo', function (Blueprint $table) { $table->string('imdbid', 100)->change(); @@ -20,10 +18,8 @@ class UpdateMovieinfoTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('movieinfo', function (Blueprint $table) { $table->unsignedMediumInteger('imdbid')->change(); diff --git a/database/migrations/2019_04_04_152238_update_user_movies_table.php b/database/migrations/2019_04_04_152238_update_user_movies_table.php index 5943f959f..cce16ce43 100644 --- a/database/migrations/2019_04_04_152238_update_user_movies_table.php +++ b/database/migrations/2019_04_04_152238_update_user_movies_table.php @@ -8,10 +8,8 @@ class UpdateUserMoviesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('user_movies', function (Blueprint $table) { $table->string('imdbid', 100)->change(); @@ -20,10 +18,8 @@ class UpdateUserMoviesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('user_movies', function (Blueprint $table) { $table->unsignedMediumInteger('imdbid')->change(); diff --git a/database/migrations/2019_06_14_095012_create_role_expiration_emails_table.php b/database/migrations/2019_06_14_095012_create_role_expiration_emails_table.php index 6e8b6a24f..a8eaf61a0 100644 --- a/database/migrations/2019_06_14_095012_create_role_expiration_emails_table.php +++ b/database/migrations/2019_06_14_095012_create_role_expiration_emails_table.php @@ -8,10 +8,8 @@ class CreateRoleExpirationEmailsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('role_expiration_emails', function (Blueprint $table) { $table->id(); @@ -25,10 +23,8 @@ class CreateRoleExpirationEmailsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('role_expiration_emails'); } diff --git a/database/migrations/2019_08_06_140408_create_invitation_user_table.php b/database/migrations/2019_08_06_140408_create_invitation_user_table.php index 936f59151..dc9cd9335 100644 --- a/database/migrations/2019_08_06_140408_create_invitation_user_table.php +++ b/database/migrations/2019_08_06_140408_create_invitation_user_table.php @@ -7,10 +7,8 @@ class CreateInvitationUserTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('user_invitations', function (Blueprint $table) { $table->id(); @@ -25,10 +23,8 @@ class CreateInvitationUserTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('user_invitations'); } diff --git a/database/migrations/2019_08_23_132941_change_passwordststatus_releases_table.php b/database/migrations/2019_08_23_132941_change_passwordststatus_releases_table.php index fbb02f6a1..f4410bcd3 100644 --- a/database/migrations/2019_08_23_132941_change_passwordststatus_releases_table.php +++ b/database/migrations/2019_08_23_132941_change_passwordststatus_releases_table.php @@ -8,10 +8,8 @@ class ChangePasswordststatusReleasesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('releases', function (Blueprint $table) { $table->smallInteger('passwordstatus')->default(-1)->change(); @@ -20,10 +18,8 @@ class ChangePasswordststatusReleasesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('releases', function (Blueprint $table) { $table->boolean('passwordstatus')->default(0)->change(); diff --git a/database/migrations/2019_10_10_231045_create_paypal_payments_table.php b/database/migrations/2019_10_10_231045_create_paypal_payments_table.php index b40dbbced..8e08071d0 100644 --- a/database/migrations/2019_10_10_231045_create_paypal_payments_table.php +++ b/database/migrations/2019_10_10_231045_create_paypal_payments_table.php @@ -8,10 +8,8 @@ class CreatePaypalPaymentsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('paypal_payments', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ class CreatePaypalPaymentsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('paypal_payments'); } diff --git a/database/migrations/2019_10_15_215953_update_tv_episodes_firstaired_column.php b/database/migrations/2019_10_15_215953_update_tv_episodes_firstaired_column.php index 338cba02e..7626998ef 100644 --- a/database/migrations/2019_10_15_215953_update_tv_episodes_firstaired_column.php +++ b/database/migrations/2019_10_15_215953_update_tv_episodes_firstaired_column.php @@ -8,10 +8,8 @@ class UpdateTvEpisodesFirstairedColumn extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('tv_episodes', function (Blueprint $table) { $table->date('firstaired')->nullable()->comment('Date of original airing/release.')->change(); @@ -20,10 +18,8 @@ class UpdateTvEpisodesFirstairedColumn extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('tv_episodes', function (Blueprint $table) { $table->date('firstaired')->comment('Date of original airing/release.')->change(); diff --git a/database/migrations/2019_10_18_205920_add_timestamps_to_videos_aliases.php b/database/migrations/2019_10_18_205920_add_timestamps_to_videos_aliases.php index e2cecc781..0c12e5d92 100644 --- a/database/migrations/2019_10_18_205920_add_timestamps_to_videos_aliases.php +++ b/database/migrations/2019_10_18_205920_add_timestamps_to_videos_aliases.php @@ -8,10 +8,8 @@ class AddTimestampsToVideosAliases extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('videos_aliases', function (Blueprint $table) { $table->timestamps(); @@ -20,10 +18,8 @@ class AddTimestampsToVideosAliases extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('videos_aliases', function (Blueprint $table) { $table->timestamps(); diff --git a/database/migrations/2019_12_30_190950_update_imdb_column_videos_table.php b/database/migrations/2019_12_30_190950_update_imdb_column_videos_table.php index d63b4b1f0..d32706902 100644 --- a/database/migrations/2019_12_30_190950_update_imdb_column_videos_table.php +++ b/database/migrations/2019_12_30_190950_update_imdb_column_videos_table.php @@ -8,10 +8,8 @@ class UpdateImdbColumnVideosTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('videos', function (Blueprint $table) { $table->string('imdb', 100)->default(0)->comment('ID number for IMDB site (without the \'tt\' prefix).')->change(); @@ -20,10 +18,8 @@ class UpdateImdbColumnVideosTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('videos', function (Blueprint $table) { $table->integer('imdb')->unsigned()->default(0)->index('ix_videos_imdb')->comment('ID number for IMDB site (without the \'tt\' prefix).'); diff --git a/database/migrations/2020_01_07_001831_add_unique_index_to_api_token.php b/database/migrations/2020_01_07_001831_add_unique_index_to_api_token.php index 3d57d7d18..e52a11dfe 100644 --- a/database/migrations/2020_01_07_001831_add_unique_index_to_api_token.php +++ b/database/migrations/2020_01_07_001831_add_unique_index_to_api_token.php @@ -8,10 +8,8 @@ class AddUniqueIndexToApiToken extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('users', function (Blueprint $table) { $table->unique('api_token', 'ux_users_api_token'); @@ -20,10 +18,8 @@ class AddUniqueIndexToApiToken extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->dropUnique('ux_users_api_token'); diff --git a/database/migrations/2020_02_17_213449_add_timezone_column_to_users_table.php b/database/migrations/2020_02_17_213449_add_timezone_column_to_users_table.php index 6a9c3ac49..7f901c04e 100644 --- a/database/migrations/2020_02_17_213449_add_timezone_column_to_users_table.php +++ b/database/migrations/2020_02_17_213449_add_timezone_column_to_users_table.php @@ -7,10 +7,8 @@ class AddTimezoneColumnToUsersTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { if (! Schema::hasColumn('users', 'timezone')) { Schema::table('users', function (Blueprint $table) { @@ -21,10 +19,8 @@ class AddTimezoneColumnToUsersTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->dropColumn('timezone'); diff --git a/database/migrations/2020_03_07_213224_remove_text_hash.php b/database/migrations/2020_03_07_213224_remove_text_hash.php index 0f07cc33e..0c4630e64 100644 --- a/database/migrations/2020_03_07_213224_remove_text_hash.php +++ b/database/migrations/2020_03_07_213224_remove_text_hash.php @@ -8,10 +8,8 @@ class RemoveTextHash extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('release_comments', function (Blueprint $table) { $sm = Schema::getConnection()->getDoctrineSchemaManager(); @@ -27,10 +25,8 @@ class RemoveTextHash extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('release_comments', function (Blueprint $table) { $table->string('text_hash', 32)->default(''); diff --git a/database/migrations/2020_07_09_223527_create_release_informs_table.php b/database/migrations/2020_07_09_223527_create_release_informs_table.php index 562e4986f..743b42035 100644 --- a/database/migrations/2020_07_09_223527_create_release_informs_table.php +++ b/database/migrations/2020_07_09_223527_create_release_informs_table.php @@ -8,10 +8,8 @@ class CreateReleaseInformsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('release_informs', function (Blueprint $table) { $table->id(); @@ -24,10 +22,8 @@ class CreateReleaseInformsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('release_informs'); } diff --git a/database/migrations/2020_08_08_212118_create_jobs_table.php b/database/migrations/2020_08_08_212118_create_jobs_table.php index 748f1e843..2ae9a4f49 100644 --- a/database/migrations/2020_08_08_212118_create_jobs_table.php +++ b/database/migrations/2020_08_08_212118_create_jobs_table.php @@ -8,10 +8,8 @@ class CreateJobsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('jobs', function (Blueprint $table) { $table->id(); @@ -26,10 +24,8 @@ class CreateJobsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('jobs'); } diff --git a/database/migrations/2020_09_27_163455_add_uuid_to_failed_jobs_table.php b/database/migrations/2020_09_27_163455_add_uuid_to_failed_jobs_table.php index 238b3dcb3..89d2decb3 100644 --- a/database/migrations/2020_09_27_163455_add_uuid_to_failed_jobs_table.php +++ b/database/migrations/2020_09_27_163455_add_uuid_to_failed_jobs_table.php @@ -8,10 +8,8 @@ class AddUuidToFailedJobsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('failed_jobs', function (Blueprint $table) { // @@ -20,10 +18,8 @@ class AddUuidToFailedJobsTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('failed_jobs', function (Blueprint $table) { // diff --git a/database/migrations/2020_12_27_214949_create_password_securities_table.php b/database/migrations/2020_12_27_214949_create_password_securities_table.php index 0208130ff..fb09538fc 100644 --- a/database/migrations/2020_12_27_214949_create_password_securities_table.php +++ b/database/migrations/2020_12_27_214949_create_password_securities_table.php @@ -8,10 +8,8 @@ class CreatePasswordSecuritiesTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('password_securities', function (Blueprint $table) { $table->id(); @@ -24,10 +22,8 @@ class CreatePasswordSecuritiesTable extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('password_securities'); } diff --git a/database/migrations/2022_02_07_220221_add_timestamps_columns_to_missed_parts.php b/database/migrations/2022_02_07_220221_add_timestamps_columns_to_missed_parts.php index 3e39de43e..d997b56af 100644 --- a/database/migrations/2022_02_07_220221_add_timestamps_columns_to_missed_parts.php +++ b/database/migrations/2022_02_07_220221_add_timestamps_columns_to_missed_parts.php @@ -8,10 +8,8 @@ class AddTimestampsColumnsToMissedParts extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('missed_parts', function (Blueprint $table) { $table->timestamps(); @@ -20,10 +18,8 @@ class AddTimestampsColumnsToMissedParts extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('missed_parts', function (Blueprint $table) { $table->timestamps(); diff --git a/database/seeders/BinaryblacklistTableSeeder.php b/database/seeders/BinaryblacklistTableSeeder.php index 21cca21c2..5106217aa 100644 --- a/database/seeders/BinaryblacklistTableSeeder.php +++ b/database/seeders/BinaryblacklistTableSeeder.php @@ -9,10 +9,8 @@ class BinaryblacklistTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('binaryblacklist')->delete(); diff --git a/database/seeders/CategoriesTableSeeder.php b/database/seeders/CategoriesTableSeeder.php index 83d5f1a3e..ba0b94028 100644 --- a/database/seeders/CategoriesTableSeeder.php +++ b/database/seeders/CategoriesTableSeeder.php @@ -9,10 +9,8 @@ class CategoriesTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); diff --git a/database/seeders/CategoryRegexesTableSeeder.php b/database/seeders/CategoryRegexesTableSeeder.php index 1c6304425..b082dc913 100644 --- a/database/seeders/CategoryRegexesTableSeeder.php +++ b/database/seeders/CategoryRegexesTableSeeder.php @@ -9,10 +9,8 @@ class CategoryRegexesTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('category_regexes')->delete(); diff --git a/database/seeders/CollectionRegexesTableSeeder.php b/database/seeders/CollectionRegexesTableSeeder.php index cebdb6725..d70963b84 100644 --- a/database/seeders/CollectionRegexesTableSeeder.php +++ b/database/seeders/CollectionRegexesTableSeeder.php @@ -9,10 +9,8 @@ class CollectionRegexesTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('collection_regexes')->delete(); diff --git a/database/seeders/ContentTableSeeder.php b/database/seeders/ContentTableSeeder.php index 786e37a87..b76fb56fa 100644 --- a/database/seeders/ContentTableSeeder.php +++ b/database/seeders/ContentTableSeeder.php @@ -9,10 +9,8 @@ class ContentTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('content')->delete(); diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 9d2ef53e1..8185210af 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -9,10 +9,8 @@ class DatabaseSeeder extends Seeder { /** * Run the database seeders. - * - * @return void */ - public function run() + public function run(): void { // $this->call(UsersTableSeeder::class); // \App\Models\User::factory(10)->create(); diff --git a/database/seeders/GenresTableSeeder.php b/database/seeders/GenresTableSeeder.php index bb4b8f055..95973906f 100644 --- a/database/seeders/GenresTableSeeder.php +++ b/database/seeders/GenresTableSeeder.php @@ -9,10 +9,8 @@ class GenresTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('genres')->delete(); diff --git a/database/seeders/GroupsTableSeeder.php b/database/seeders/GroupsTableSeeder.php index d5cf74db7..5f7a826ba 100644 --- a/database/seeders/GroupsTableSeeder.php +++ b/database/seeders/GroupsTableSeeder.php @@ -9,10 +9,8 @@ class GroupsTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('usenet_groups')->delete(); diff --git a/database/seeders/ReleaseNamingRegexesTableSeeder.php b/database/seeders/ReleaseNamingRegexesTableSeeder.php index 71561b3d8..37e76b553 100644 --- a/database/seeders/ReleaseNamingRegexesTableSeeder.php +++ b/database/seeders/ReleaseNamingRegexesTableSeeder.php @@ -9,10 +9,8 @@ class ReleaseNamingRegexesTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('release_naming_regexes')->delete(); diff --git a/database/seeders/RolesAndPermissionsSeeder.php b/database/seeders/RolesAndPermissionsSeeder.php index 7df6f2f02..b81c54c2c 100644 --- a/database/seeders/RolesAndPermissionsSeeder.php +++ b/database/seeders/RolesAndPermissionsSeeder.php @@ -10,10 +10,8 @@ class RolesAndPermissionsSeeder extends Seeder { /** * Run the database seeders. - * - * @return void */ - public function run() + public function run(): void { // Reset cached roles and permissions app('cache')->forget('spatie.permission.cache'); diff --git a/database/seeders/RootCategoriesTableSeeder.php b/database/seeders/RootCategoriesTableSeeder.php index 2ff221080..786e90eab 100644 --- a/database/seeders/RootCategoriesTableSeeder.php +++ b/database/seeders/RootCategoriesTableSeeder.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\DB; class RootCategoriesTableSeeder extends Seeder { - public function run() + public function run(): void { DB::table('root_categories')->delete(); diff --git a/database/seeders/SettingsTableSeeder.php b/database/seeders/SettingsTableSeeder.php index 7c855607a..a560de250 100644 --- a/database/seeders/SettingsTableSeeder.php +++ b/database/seeders/SettingsTableSeeder.php @@ -9,10 +9,8 @@ class SettingsTableSeeder extends Seeder { /** * Auto generated seed file. - * - * @return void */ - public function run() + public function run(): void { DB::table('settings')->delete(); diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php deleted file mode 100644 index e5506df29..000000000 --- a/resources/lang/en/auth.php +++ /dev/null @@ -1,19 +0,0 @@ - 'These credentials do not match our records.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - -]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php deleted file mode 100644 index d48141187..000000000 --- a/resources/lang/en/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« Previous', - 'next' => 'Next »', - -]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php deleted file mode 100644 index e5544d201..000000000 --- a/resources/lang/en/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Passwords must be at least six characters and match the confirmation.', - 'reset' => 'Your password has been reset!', - 'sent' => 'We have e-mailed your password reset link!', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that e-mail address.", - -]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php deleted file mode 100644 index b59ca31d6..000000000 --- a/resources/lang/en/validation.php +++ /dev/null @@ -1,121 +0,0 @@ - 'The :attribute must be accepted.', - '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 may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - '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.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'image' => 'The :attribute 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.', - 'max' => [ - 'numeric' => 'The :attribute may not be greater than :max.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'string' => 'The :attribute may not be greater than :max characters.', - 'array' => 'The :attribute may not have more than :max items.', - ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', - 'array' => 'The :attribute must have at least :min items.', - ], - 'not_in' => 'The selected :attribute is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'present' => 'The :attribute field must be present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values is 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.', - 'size' => [ - 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', - ], - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute format is invalid.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap attribute place-holders - | with something more reader friendly such as E-Mail Address instead - | of "email". This simply helps us make messages a little cleaner. - | - */ - - 'attributes' => [], - -]; diff --git a/resources/views/auth/2fa.blade.php b/resources/views/auth/2fa.blade.php index eb44a3bdc..c4ba83cb2 100644 --- a/resources/views/auth/2fa.blade.php +++ b/resources/views/auth/2fa.blade.php @@ -32,7 +32,7 @@ @if(!($data['user']->passwordSecurity))
- {{ csrf_field() }} + @csrf
diff --git a/resources/views/auth/google2fa.blade.php b/resources/views/auth/google2fa.blade.php index 84162d896..e4fd5e918 100644 --- a/resources/views/auth/google2fa.blade.php +++ b/resources/views/auth/google2fa.blade.php @@ -22,7 +22,7 @@ Enter the pin from Google Authenticator Enable 2FA

- {{ csrf_field() }} + @csrf
diff --git a/routes/api.php b/routes/api.php index c5ec50132..c57a8105f 100644 --- a/routes/api.php +++ b/routes/api.php @@ -15,17 +15,17 @@ use App\Http\Controllers\Api\ApiController; use App\Http\Controllers\Api\ApiInformController; use App\Http\Controllers\Api\ApiV2Controller; -Route::group(['prefix' => 'v1', 'namespace' => 'Api'], function () { +Route::prefix('v1')->group(function () { Route::get('api', [ApiController::class, 'api']); Route::post('api', [ApiController::class, 'api']); }); -Route::group(['prefix' => 'v2', 'namespace' => 'Api'], function () { +Route::prefix('v2')->group(function () { Route::get('capabilities', [ApiV2Controller::class, 'capabilities']); Route::post('capabilities', [ApiV2Controller::class, 'capabilities']); }); -Route::group(['prefix' => 'v2', 'namespace' => 'Api', 'middleware' => ['auth:api', 'throttle:rate_limit,1']], function () { +Route::prefix('v2')->middleware('auth:api', 'throttle:rate_limit,1')->group(function () { Route::get('movies', [ApiV2Controller::class, 'movie']); Route::post('movies', [ApiV2Controller::class, 'movie']); Route::get('search', [ApiV2Controller::class, 'apiSearch']); @@ -38,7 +38,7 @@ Route::group(['prefix' => 'v2', 'namespace' => 'Api', 'middleware' => ['auth:api Route::post('details', [ApiV2Controller::class, 'details']); }); -Route::group(['prefix' => 'inform', 'namespace' => 'Api', 'middleware' => ['auth:api']], function () { +Route::prefix('inform')->middleware('auth:api')->group(function () { Route::get('release', [ApiInformController::class, 'release']); Route::post('release', [ApiInformController::class, 'release']); }); diff --git a/routes/rss.php b/routes/rss.php index 68aa76a4b..98b5719d0 100644 --- a/routes/rss.php +++ b/routes/rss.php @@ -11,7 +11,7 @@ use App\Http\Controllers\RssController; -Route::group(['guard' => 'rss', 'middleware' => ['auth:api']], function () { +Route::middleware('auth:api')->group(['guard' => 'rss',], function () { Route::get('mymovies', [RssController::class, 'myMoviesRss']); Route::post('mymovies', [RssController::class, 'myMoviesRss']); Route::get('myshows', [RssController::class, 'myShowsRss']); diff --git a/routes/web.php b/routes/web.php index 27333f03f..881372736 100644 --- a/routes/web.php +++ b/routes/web.php @@ -86,13 +86,13 @@ Route::get('login', [LoginController::class, 'showLoginForm']); Route::post('login', [LoginController::class, 'login'])->name('login'); Route::get('logout', [LoginController::class, 'logout'])->name('logout'); -Route::group(['middleware' => ['isVerified']], function () { +Route::middleware('isVerified')->group(function () { Route::get('resetpassword', [ResetPasswordController::class, 'reset']); Route::post('resetpassword', [ResetPasswordController::class, 'reset']); Route::get('profile', [ProfileController::class, 'show']); - Route::group(['prefix' => 'browse'], function () { + Route::prefix('browse')->group(function () { Route::get('tags', [BrowseController::class, 'tags']); Route::get('group', [BrowseController::class, 'group']); Route::get('All', [BrowseController::class, 'index']); @@ -132,7 +132,7 @@ Route::group(['middleware' => ['isVerified']], function () { Route::post('failed', [FailedReleasesController::class, 'failed'])->name('failed'); - Route::group(['middleware' => 'clearance'], function () { + Route::middleware('clearance')->group(function () { Route::get('Games', [GamesController::class, 'show'])->name('Games'); Route::post('Games', [GamesController::class, 'show'])->name('Games'); @@ -247,7 +247,7 @@ Route::get('forum-delete/{id}', [ForumController::class, 'destroy'])->middleware Route::post('forum-delete/{id}', [ForumController::class, 'destroy'])->middleware('role:Admin'); -Route::group(['middleware' => ['role:Admin', '2fa'], 'prefix' => 'admin', 'namespace' => 'Admin'], function () { +Route::middleware('role:Admin', '2fa')->prefix('admin')->group(function () { Route::get('index', [AdminPageController::class, 'index']); Route::get('anidb-delete/{id}', [AdminAnidbController::class, 'destroy']); Route::post('anidb-delete/{id}', [AdminAnidbController::class, 'destroy']); @@ -366,11 +366,11 @@ Route::group(['middleware' => ['role:Admin', '2fa'], 'prefix' => 'admin', 'names Route::post('group-list-inactive', [AdminGroupController::class, 'inactive']); }); -Route::group(['middleware' => ['role_or_permission:Admin|Moderator|edit release'], 'prefix' => 'admin', 'namespace' => 'Admin'], function () { +Route::middleware('role_or_permission:Admin|Moderator|edit release')->prefix('admin')->group(function () { Route::get('release-edit', [AdminReleasesController::class, 'edit']); Route::post('release-edit', [AdminReleasesController::class, 'edit']); }); Route::post('2faVerify', function () { - return redirect(URL()->previous()); + return redirect()->to(URL()->previous()); })->name('2faVerify')->middleware('2fa'); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f6a..9b7cfa6a5 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -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'; diff --git a/tests/Feature/BooksTest.php b/tests/Feature/BooksTest.php index c602d598d..83ade8800 100644 --- a/tests/Feature/BooksTest.php +++ b/tests/Feature/BooksTest.php @@ -10,7 +10,7 @@ class BooksTest extends TestCase * @throws \DariusIII\ItunesApi\Exceptions\InvalidProviderException * @throws \Exception */ - public function testFetchItunesBookProperties() + public function testFetchItunesBookProperties(): void { $book = (new \Blacklight\Books())->fetchItunesBookProperties('The Volunteer'); diff --git a/tests/Feature/GetBooksBrowseByOptionsTest.php b/tests/Feature/GetBooksBrowseByOptionsTest.php index f233069b8..e6049aff2 100644 --- a/tests/Feature/GetBooksBrowseByOptionsTest.php +++ b/tests/Feature/GetBooksBrowseByOptionsTest.php @@ -10,7 +10,7 @@ class GetBooksBrowseByOptionsTest extends TestCase /** * @throws \Exception */ - public function testBookBrowseByTest() + public function testBookBrowseByTest(): void { $books = (new Books())->getBrowseByOptions(); $this->assertArrayHasKey('author', $books); diff --git a/tests/Feature/SettingsTest.php b/tests/Feature/SettingsTest.php index a9830014a..d3e5b6d11 100644 --- a/tests/Feature/SettingsTest.php +++ b/tests/Feature/SettingsTest.php @@ -6,7 +6,7 @@ use Tests\TestCase; class SettingsTest extends TestCase { - public function testSettingValue() + public function testSettingValue(): void { $name = config('app.name'); diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index 6a5f5fe2d..10dce04c9 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -20,7 +20,7 @@ require_once \dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; */ class InstallTest extends \PHPUnit\Framework\TestCase { - public function testFullInstall() + public function testFullInstall(): void { passthru('php '.base_path().'/artisan migrate:fresh --seed');