I am having issue while fetching data once form submission happens. I am able to fetch records if I use view->with() but when I refresh It generates error due to dependency of table as resubmission happens. I want fetch some data once form submission will be completed and redirect will be done. Here Is my controller -
**public function postNewProject(Request $request){
$client_id = (int)session('clid');
$subclient_id=(int)session('subclientid');
$innvation_sponser=$request->get('innvation_sponser');
$innovation_champion=$request->get('innovation_champion');
$department=$request->get('department');
$projectname=$request->get('projectname');
$championemail=$request->get('championemail');
$championphone=$request->get('championphone');
$startenddate=$request->get('startenddate');
$connecteddate = str_replace(' ', '', $startenddate);
$splitteddate = explode("-", $connecteddate);
$start_date=$splitteddate[0];
$end_date=$splitteddate[1];
$usable_start_date=date_create(date($start_date));
$usable_end_date=date_create(date($end_date));
innomantraprojects::create([
'client_id' => $client_id,
'subclient_id'=>$subclient_id,
'innvation_sponser'=>$innvation_sponser,
'innovation_champion'=>$innovation_champion,
'department'=>$department,
'projectname'=>$projectname,
'championemail'=>$championemail,
'championphone'=>$championphone,
'start_date'=>$usable_start_date,
'end_date'=>$usable_end_date,
]);
// $subclients = DB::table('subclients')->where('client_id',$client_id)->get();
// $projectlist=DB::table('innomantraproject')->where('client_id',$client_id)->get();
// return view('project-list')->with('subclients',$subclients)->with('projectlist',$projectlist);
return redirect('project-list');
}
}**
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2m2fYJc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire