Ad

October Database

- 1 answer

I have this code

public function onRequest(){

    $users = \Db::table('engegraph_forms_membros')->get();

    foreach ($users as $part) {
        echo $part->membro;  // membro ITS NAME FROM ONE COLUMN IN MY DATABASE
    }
}

My code

This works on page, but I want send this to a partial, in my database I have 3 columns and I want to show the values of column there.

Partial code

I have tried many ways but I don't understand well the docs, sorry for my English. If someone help me I would be grateful.

Ad

Answer

I am assuming you have this onRequest function on a component so write below code on it.

public function onRun(){

$this->page['users'] = $this->onRequest();

}

public function onRequest(){

    return \Db::table('engegraph_forms_membros')->get();

}

now users variable will be available on your page and partial.

Ad
source: stackoverflow.com
Ad