samedi 27 janvier 2018

Turn Codeigniter Query to Laravel

Sorry for broken english. I've codeigniter query like this :

$this->db->select('tbl_news.id','tbl_news.news_title','tbl_news.news_desc','tbl_news.date_created','tbl_source.source as source','tbl_news.thumb','tbl_category.category');
$this->db->from('tbl_news');
$this->db->join('tbl_category','tbl_category.id','=','tbl_news.news_category')
$this->db->join('tbl_source','tbl_source.id','=','tbl_news.source')
$data = $this->db->get('', $size, $page)->result_array();

and i try to turn that query to my laravel using query builder, like this :

$data= DB::table('tbl_news')
    ->select('tbl_news.id','tbl_news.news_title','tbl_news.news_desc','tbl_news.date_created','tbl_source.source as source','tbl_news.thumb','tbl_category.category')
    ->join('tbl_category','tbl_category.id','=','tbl_news.news_category')
    ->join('tbl_source','tbl_source.id','=','tbl_news.source')
    ->get('',$size,$page)
    ->toArray();

is it posible in laravel to have 'get' with parameter ? because i want to make pagination, but i dont want to use paginate because it will affect the response that i used in my android.

->get('',$size,$page)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire