I want to pass $valPrev from AddressController.php to FrontController.php. I am using with function to pass variable.
Front Controller.php
public function index2($valPrev){
$shop=Products::all();
$valPre = Input::get('valPrev');
dd($valPrev);
$garma = Products::where('season','=','Summer')->take(4)->get();
$sarma = Products::where('season','=','Winter')->take(4)->get();
$khizan = Products::where('season','=','Autumn')->take(4)->get();
$bahar = Products::where('season','=','Spring')->take(4)->get();
$review = Review::orderby('id','desc')->take(2)->get();
return view('front.index',compact('shop','garma','sarma','khizan','bahar','review'));
}
AddressController.php
public function store(Request $request)
{
$this->validate($request,[
'fname'=>'required',
'lname'=>'required',
'Ttl'=>'required',
'email'=>'required|email',
'addressline'=>'required',
'city'=>'required',
'pro'=>'required',
'phone'=>'required |http://regex:/^[0-9\-\+]{9,15}$/',
]);
Address::create($request->all());
$pro=$request->Ttl;
$proo=$request->pro;
return redirect('/')->with('valPrev',1);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire