Reputation: 161
I am currently working on a project in Laravel 10 using Backpack v6.x
I am stuck with trying to access custom data in my show,list,create crud pages. A sample is this with my list operation
protected function setupListOperation()
{
$this->crud->query = $this->crud->query->where('status', 'processing');
$this->crud->addColumn('user_id');
$this->crud->addColumn('total_price');
$this->crud->addColumn('payment_status');
$this->crud->addColumn('status');
$this->data=["test"];
$this->crud->setListView('custom.crud.order.list');
}
How can I access the data in my view blade?
I tried $data, $crud->data but I am getting nowhere.
If this is wrong, what is the best way to pass data to my custom view pages?
Upvotes: 0
Views: 325
Reputation: 161
I managed to find how to access the custom data.
In the crud controller, add the object inside the data array
$this->data["test"]="test data";
Then to be able to access it in the view, call the key name
var_dump($test);
// test data
Hope this helps someone else in the future since I couldnt find it in any of the documentation.
Upvotes: 1