I need to add check boxes for services like " facebook, twitter, youtube" in client creation page the values will be the same name and should be saved in service column to be viewed in a table for clients
how to do it in controller and create view
this is the controller @store
$input = $request->except('service');
$services = $request['service'];
if(isset($services)) {
foreach ($services as $service) {
$input['service'] = $services;
}
}
Client::create($input);
return redirect('admin/clients');
and this the view
{!! Form::open(array('method' => 'Post', 'action'=>'ClientController@store','files'=>true))!!}
<div class="form-group">
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title',null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('description', 'Description:') !!}
{!! Form::text('description',null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('phone', 'Contact Phone:') !!}
{!! Form::text('phone',null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('start', 'Contract Start Date:') !!}
{!! Form::date('start',null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('end', 'Contract End Date:') !!}
{!! Form::date('end',null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('status', 'Status:') !!}
{!! Form::select('status', array('1' => 'Active', '0' => 'Not Active'),1, ['class'=>'form-control']);
!!}
<div class="form-group">
{!! Form::label('service', 'Facebook:') !!}
{!! Form::checkbox('service','Facebook') !!}
{!! Form::label('service', 'Twitter:') !!}
{!! Form::checkbox('service','Twitter') !!}
{!! Form::label('service', 'Youtube:') !!}
{!! Form::checkbox('service','Youtube') !!}
</div>
<div class="form-group">
{!! Form::submit('Create User',['class'=>'btn btn-primary']) !!}
</div>
{!! Form::close() !!}
Aucun commentaire:
Enregistrer un commentaire