GetEstimateController.php
class GetEstimationController extends Controller { public function fill_dropbox(){ $data = ProcedureTreat::get(['pro_name']); $data1 = HospitalPackage::get(['address']); // return $this->get_estimate(); // dd($data); return View::make('get_quote')->with('address',$data1)->with('procedureName',$data); } public function get_estimate($name,$address){ $data = HospitalPackage::where(['pro' => 'name', 'address' => 'address'])->get(); $Dropbox_fill = $this->fill_dropbox(); // dd($Dropbox_fill); return View::make('get_quote')->with('HospitalPack',$data); } }
routes.php
Route::get('/',[ 'uses' => 'GetEstimationController@fill_dropbox', 'as' => 'fill.dropbox' ]); Route::any('/find/{name}/{address}',[ 'uses' => 'GetEstimationController@get_estimate', 'as' => 'get.estimate' ]);
get_quote.blade.php
@if(isset($procedureName)) @foreach($procedureName as $key => $data) <option value="{{$data->pro_name}}">{{$data->pro_name}}</option> @endforeach @endif @if(isset($address)) @foreach($address as $key => $add) <option value="{{$add->address}}">{{$add->address}}</option> @endforeach @endif
Я хочу вызвать fill_dropbox
funtion внутри функции get_estimate
и снова отправить данные в get_quote.blade.php
.
Использование $Dropbox_fill = $this->fill_dropbox();
Я получаю данные
View {#155 ▼ #factory: Factory {#141 ▶} #engine: CompilerEngine {#148 ▶} #view: "get_quote" #data: array:2 [▼ "address" => Collection {#2507 ▼ #items: array:1382 [▼ 0 => HospitalPackage {#2508 …24} 1 => HospitalPackage {#2509 …24} 2 => HospitalPackage {#2510 …24} 3 => HospitalPackage {#2511 …24} } "procedureName" => Collection {#1124 ▶} ] #path: "C:\wamp\www\IIMTC\bmmt_new\resources\views/get_quote.blade.php" }
так как я могу получить к нему доступ в get_quote.blade.php
с предыдущим foreach
.