This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(torrent/snatch): Separate Torrent::getSnatchDetails to torre…
…nt\SnatchForm Pager
- Loading branch information
Showing
10 changed files
with
83 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Rhilip | ||
* Date: 8/6/2019 | ||
* Time: 8:40 PM | ||
*/ | ||
|
||
namespace apps\models\form\Torrent; | ||
|
||
use apps\models\form\Traits\isValidTorrentTrait; | ||
use Rid\Validators\Pager; | ||
|
||
class SnatchForm extends Pager | ||
{ | ||
use isValidTorrentTrait; | ||
|
||
public static function inputRules() | ||
{ | ||
return array_merge(parent::inputRules(), [ | ||
'id' => 'required | Integer' | ||
]); | ||
} | ||
|
||
public static function callbackRules() | ||
{ | ||
return ['checkPager', 'isExistTorrent']; | ||
} | ||
|
||
protected function getRemoteTotal() | ||
{ | ||
$tid = $this->getData('id'); | ||
return app()->pdo->createCommand('SELECT COUNT(`id`) FROM `snatched` WHERE `torrent_id` = :tid')->bindParams([ | ||
'tid' => $tid | ||
])->queryScalar(); | ||
} | ||
|
||
protected function getRemoteData() | ||
{ | ||
return app()->pdo->createCommand([ | ||
['SELECT * FROM `snatched` WHERE `torrent_id` = :tid ORDER BY finish_at,create_at DESC ', 'params' => ['tid' => $this->id]], | ||
['LIMIT :offset, :limit', 'params' => ['offset' => $this->offset, 'limit' => $this->limit]] | ||
])->queryAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters