I am working on a project with Laravel 5.2. I am not getting any error whatsoever and my form isnt submitting as well.
heres my form
<form class="form-horizontal">
{!! Form::open(['method'=>'POST','action'=>'TicketsController@store','files'=>true],['class=>form-horizontal form bordered']) !!}
<div class="form-group">
{!! Form::label('problem_title','title',['class'=>'control-label col-lg-2']) !!}
<div class="col-lg-10">{!! Form::text('problem_title',null,['class'=>'form-control']) !!}</div>
</div>
<div class="form-group ">
{!! Form::label('category_id','Category:',['class'=>'control-label col-lg-2']) !!}
<div class="col-lg-10">{!! Form::select('category_id',$categories,'3',['class'=>'form-control']) !!}</div>
</div>
<div class="form-group ">
{!! Form::label('Status_id','Status:',['class'=>'control-label col-lg-2']) !!}
<div class="col-lg-10">{!! Form::select('status_id',$statuses,'3',['class'=>'form-control']) !!}</div>
</div>
<div class="form-group">
{!! Form::label('body','How can We help you?',['class'=>'control-label col-lg-2']) !!}
<div class="col-lg-10">{!! Form::text('body',null,['class'=>'form-control','rows'=>5 ,'cols'=>5]) !!}</div>
</div>
<div class="form-group">
{!! Form::label('photo_id','ScreenShot:',['class'=>'control-label col-lg-2']) !!}
<div class="col-lg-10">{!! Form::file('photo_id', ['class'=>'form-control']) !!}</div>
</div>
<div class="text-right">
{!! Form::submit('Create Ticket',['class'=>'btn btn-primary ']) !!}
</div>
</form>
Also this is my controller to create and store the form.
public function create()
{
$categories=Category::lists('name','id')->all();
$statuses=Status::lists('name','id')->all();
return view('tickets.create', compact('categories','statuses','users'));
}
public function store(Request $request)
{
{
$user=Auth::user();
$input = $request->all();
if($file=$request->file('photo_id')){
$name=time() . $file->getClientOriginalName();
$file-> move('images',$name);
$photo=Photo::create(['file'=>$name]);
$input['photo_id']=$photo->id;
}
$user->ticket()->create($input);
/*Post::create($input);*/
return redirect('tickets');
}
}
What am I doing wrong? I am getting this in my URL after I have submitted the form. Kidly help out, I am running out of time.
http://www.projecty.com/tickets/create?_token=eXQHc1FS8mObR4lbyqxvXlASyZfZNidVgnjacaSb&_token=eXQHc1FS8mObR4lbyqxvXlASyZfZNidVgnjacaSb&problem_title=chuu&category_id=2&status_id=1&body=h7ju87&photo_id=house.jpg
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DYaThT
via IFTTT
Aucun commentaire:
Enregistrer un commentaire