本文整理汇总了PHP中Sites::findByUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Sites::findByUrl方法的具体用法?PHP Sites::findByUrl怎么用?PHP Sites::findByUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sites
的用法示例。
在下文中一共展示了Sites::findByUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLinkBy
public function addLinkBy(Users $byUser, $url)
{
$data = array('url' => $url, 'linkable_id' => $this->id, 'linkable_type' => get_class($this), 'site_id' => Sites::findByUrl($url)->id, 'user_id' => $byUser->id);
$link = new Links();
$link->save($data);
return $this;
}
示例2: updateEpisodesInfo
public function updateEpisodesInfo($url = null, $for_season_num = null)
{
// dd($for_season_num);
if ($url == null) {
$url = $this->getFirstKATLink()->url;
$link = $this->getDI()->get('url')->get(['for' => 'tvserials.show', 'tvserial' => $this->id]);
if (!$url) {
echo '无法获取KAT的url地址,请先设置本连续剧的kat地址:<a href="' . $link . '">链接</a>';
die;
}
}
// dd($url);
$parser = Sites::findByUrl($url)->getParser();
$data = $parser->parseTVSerialsinfo($url);
$this->updateTvSerial($data['info']);
$seasons = $data['seasons'];
foreach ($seasons as $season => $episodes) {
// $season_number = (int) preg_replace('|^Season\s+([0-9]+)$|','$1',$season);
$season_number = $season;
if (null != $for_season_num and $for_season_num != $season_number) {
continue;
}
$serial = $this->getSerialBySeasonNum($season_number);
// dd($serial);
if (null == $serial) {
continue;
}
//如果没有序列的话,则直接退出
foreach ($episodes as $episode) {
$num = $episode['num'];
if ($e = Episodes::findBySerialAndNumOrNew($serial->id, $num)) {
$this->saveEpisode($episode, $e, $serial);
}
}
}
}