Passing multiple variables to view

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Kevin
Posts: 13
Joined: 28 Nov 2017, 19:54

Passing multiple variables to view

Post by Kevin » 28 Nov 2017, 20:02

Hi all,

I'm struggling with my Laravel + CodeIgniter instance. I did update my routes so the myaccount function is handled through my own controller instead of the default AccountController that comes with Aimeos.

The code to within my function is the following and works perfect:

Code: Select all

$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'account-index' );
return Response::view('shop::account.index', $params);
Now I want to pass an extra parameter to the view, but the system keeps failing with everything I'm trying... I keep receiving the error that 'Aibody' in an undefined variable.

I did try every possible Laravel way to pass multiple parameters to the view:

Code: Select all

return view('shop::account.subscriptions', compact('params', 'otherarray'));

Code: Select all

$data = array(
		   'params'  => $params,
		   'testarray'   => $testarray,
		);
return View::make('shop::account.subscriptions')->with($data);
Even this basic function to pass a variable to the view is failing:

Code: Select all

return View::make('shop::account.subscriptions', compact('params'));
Who can help me out on this one? Much appreciated!

Regards,
Kevin

User avatar
aimeos
Administrator
Posts: 7865
Joined: 01 Jan 1970, 00:00

Re: Passing multiple variables to view

Post by aimeos » 28 Nov 2017, 22:29

What about simply using

Code: Select all

$params['myparam'] = '...';
or

Code: Select all

$params = array_merge( $params, $otherarray );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Kevin
Posts: 13
Joined: 28 Nov 2017, 19:54

Re: Passing multiple variables to view

Post by Kevin » 30 Nov 2017, 14:37

Thanks!

Post Reply