php - Laravel Raw query paginate; raw query to eloquent object -


select '0000-00-00' date, 'opening balance' narration, (select debit `account_sub_journal` id=1)as debit, (select credit `account_sub_journal` id=1)as credit, '0' transaction_entry_id,'0' account_sub_journal_id  union select * `ledgertransactions` account_sub_journal_id = 1 , `date` between  '2014-04-01' , '2014-04-10' 

i static function in model. couldn't paginate since laravel says not object

public static function ledgerbook_to($account_id,$date){         $book =  db::select( db::raw("select  '0000-00-00' date,  'opening balance' narration, (select debit  `account_sub_journal` id =1) debit, (select credit  `account_sub_journal` id = :account_id) credit,  '0' transaction_entry_id,  '0' account_sub_journal_id union select *  `ledgertransactions` account_sub_journal_id =:account_id_t , `date` <= :date_to "), array(    'account_id' => $account_id,'account_id_t' => $account_id,'date_to' => $date));         return $book;     } 

i union if @ least solve below query in eloquent.

select  '0000-00-00' date,  'opening balance' narration, (select debit  `account_sub_journal` id =1) debit, (select credit  `account_sub_journal` id =1) credit,  '0' transaction_entry_id,  '0' account_sub_journal_id 

thank support

you can generate pagination links manually using this:

$pagination = paginator::make($book, count($book), 5); 

then may use this:

echo $pagination->links(); 

or (blade) this:

{{ $pagination->links() }} 

check the documentation know more creating pagination manually.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -