Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Using class to render partial view

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #194128
    matthisco
    Participant

    Hi Folks,

    I’m trying to use a class to render partials throughout my site:

    I have this main class, payment.php

    class Payment {

    private function GetUserPayments($isPaid = false)
    {
    //eloquent stuff

    return $results
    }

    }

    I would like to reuse this throughout my site in my controller, something like this:

    public function getPendingPayments()
    {

    $payments = $this->Payments::GetUserPayments(true);
    
    
    return View::make(
        'layouts.parents.pending-payments',
        array('payments' => $payments)  );
    

    }

    I am getting an error: PHP Parse error: syntax error, unexpected ‘::’.

    Can anyone please pointme in the right direction, how could I resuse this class throughout my controller?

    Many thanks

    #194146
    matthisco
    Participant

    Thanks for the reply, I’ll repost no there, cheers.

    #194148
    Alen
    Participant

    @matthisco, you can’t reference Laravel Facade with this->Payments::....

    Try

    $payments = Payments::GetUserPayments(true);
    

    Payments gets resolved out of the IoC container.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.