Sindbad~EG File Manager
<?php
use Illuminate\Database\Eloquent\SoftDeletingTrait;
class TopicFollow extends Eloquent
{
use SoftDeletingTrait;
protected $table = 'topic_follow';
protected $primaryKey = 'topic_follow_id';
public Static function getTopicFollowsByUserID($userID,$page,$no_of_records)
{
try
{
if(intval($userID) > 0 )
{
if(isset($page) && isset($no_of_records))
$topics = DB::table("topic_follow as tf")
->leftJoin("topics as t", "t.topic_id", "=", "tf.topic_id")
->leftJoin("categories as c", "c.category_id", "=", "t.category_id")
->whereNull("tf.deleted_at")
->where("tf.user_id", "=", $userID)
->orderBy("t.updated_at", "desc")
->skip(($page - 1)*$no_of_records)
->take($no_of_records)
->select("t.topic_id","t.title","c.category_id as category_id", "c.color_code","c.forum_is_visible as category_is_visible" ,"c.name as category_name", "t.user_id as created_by_id", "t.user_name as created_by_name")
->get();
else
$topics = DB::table("topic_follow as tf")
->leftJoin("topics as t", "t.topic_id", "=", "tf.topic_id")
->leftJoin("categories as c", "c.category_id", "=", "t.category_id")
->whereNull("tf.deleted_at")
->where("tf.user_id", "=", $userID)
->orderBy("t.updated_at", "desc")
->select("t.topic_id","t.title","c.category_id as category_id", "c.color_code","c.forum_is_visible as category_is_visible" ,"c.name as category_name", "t.user_id as created_by_id", "t.user_name as created_by_name")
->get();
}
return $topics;
} catch (Exception $e)
{
Log::error('Models: Reply -> getRepliesByTopicID '.$e->getMessage());
return [];
}
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists