Support the ongoing development of Laravel.io →
Database Views Blade
Last updated 2 years ago.
0

I am not quite sure I get what you are trying to do, but have you looked at View composers?

http://laravel.com/docs/4.2/responses#view-composers

Last updated 2 years ago.
0
Solution

Hi, I actually managed to get what I was after by putting my queries in the BaseController.php like this:

class BaseController extends Controller {

public function __construct()
{

	$bomserial = Input::get('bomserial');
	$bomserials = DB::table('ph_bom_table_head')->select('serial', 'job_desc')->orderBy('serial', 'ASC')->get();
	$bomsections = DB::table('ph_bom_table_sections')->select('serial', 'part_num', 'part_desc')->where('serial', '=', $bomserial)->get();

	$message = "There are no results   ¯\_(&#12484)_/¯";

	return View::share(compact('bomserials', 'bomsections', 'message', 'dateSql'));

}

Now my queries are available in all views.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

gmask gmask Joined 1 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.