Sindbad~EG File Manager
<?php
class OtherPost extends Eloquent {
protected $primaryKey = 'other_posts_id';
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'other_posts';
public Static function GetUserPresentPosts($type,$user_id = null)
{
try
{
$user_id = $user_id==null?Auth::user()->user_id:$user_id;
$posts = Post::join('other_posts','other_posts.post_id','=','posts.post_id')
->where('posts.post_type',$type)
->where('other_posts.user_id',$user_id)
->where('other_posts.post_type','PRESENT')
->orderby('other_posts.other_posts_id')
->select('other_posts.other_posts_id','other_posts.post_id','other_posts.post_type','other_posts.from_year','to_year')
->get();
return $posts;
} catch (Exception $e)
{
Log::error('Models: OtherPost -> GetUserPresentPosts '.$e->getMessage());
return [];
}
}
public Static function GetUserPreviousPosts($type,$user_id = null)
{
try
{
$user_id = $user_id==null?Auth::user()->user_id:$user_id;
$posts = Post::join('other_posts','other_posts.post_id','=','posts.post_id')
->where('posts.post_type',$type)
->where('other_posts.user_id',$user_id)
->where('other_posts.post_type','PREVIOUS')
->orderby('other_posts.other_posts_id')
->select('other_posts.other_posts_id','other_posts.post_id','other_posts.post_type','other_posts.from_year','to_year')
->get();
return $posts;
} catch (Exception $e)
{
Log::error('Models: OtherPost -> GetUserPreviousPosts '.$e->getMessage());
return [];
}
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists