You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							39 lines
						
					
					
						
							1.1 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							39 lines
						
					
					
						
							1.1 KiB
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								namespace App\Http\Controllers;
							 | 
						|
								
							 | 
						|
								use Illuminate\Http\Request;
							 | 
						|
								use App\Models\Adjunct;
							 | 
						|
								use App\Models\Adjunctaddition;
							 | 
						|
								use App\Models\Summarie;
							 | 
						|
								use Illuminate\Support\Facades\DB;
							 | 
						|
								
							 | 
						|
								class AdjunctcardController extends Controller
							 | 
						|
								{
							 | 
						|
								    public function __construct()
							 | 
						|
								    {
							 | 
						|
								        $this->middleware('auth');
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								    public function index($adjunctID)
							 | 
						|
								    {
							 | 
						|
								        $adjunct = Adjunct::where('id', $adjunctID)->first();
							 | 
						|
									$adjunctadditions = Adjunctaddition::where('adjunct_id', $adjunctID)->distinct('beer_id')->get();
							 | 
						|
									foreach ($adjunctadditions as $adjuncts)
							 | 
						|
									{
							 | 
						|
										$beerName = DB::table('summaries')->where('beer_id', $adjuncts->beer_id)->value('name');
							 | 
						|
										$breweryID = DB::table('summaries')->where('beer_id', $adjuncts->beer_id)->value('brewery_id');
							 | 
						|
										$breweryName = DB::table('breweries')->where('id', $breweryID)->value('name');
							 | 
						|
										$adjuncts['beer'] = $beerName;
							 | 
						|
										$adjuncts['breweryID'] = $breweryID;
							 | 
						|
										$adjuncts['brewery']=$breweryName;
							 | 
						|
									}
							 | 
						|
								        $adjunctadditions = $adjunctadditions->sortBy('brewery');
							 | 
						|
									$data = array('adjunct'=>$adjunct, 'adjunctadditions'=>$adjunctadditions);
							 | 
						|
								        return view('adjunct')->with($data);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								}
							 | 
						|
								
							 |