Undefined property: stdClass::$showFooterWidgetOne - laravel

has('showFooterWidgetOne') ? ' has-error' : ''); ?>">
<label>Footer Widget 1 </label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-pencil"></i>
</div>
<select name="showFooterWidgetOne" class="form-control">
<!----------- error part ----------->
<option value="Yes" <?php if($SRow->showFooterWidgetOne == 'Yes'): echo 'selected'; endif;?>>Yes</option>
<option value="No" <?php if($SRow->showFooterWidgetOne == 'No'): echo 'selected'; endif;?>>No</option>
</select>
</div>
</div>
<!-- /.form-group -->
I'm noob in laravel and i got some work accidently in laravel. also get that issue when try add some new field in form but when i added field then i start getting this error showing in image. Please help me to get out from this issue. Thanks for helping.

It seems that $Srow is not a Laravel model. Try to access the showFooterWidgetOne property like an array. Change this line <?php if($SRow->showFooterWidgetOne == 'Yes') to #php if($SRow['showFooterWidgetOne'] == 'Yes') ... #endphp.

Related

Getting selected checkbox from database - laravel

I am able to save checkbox values into my database. When i am fetching, i try to get the selected checkbox as below but nothing is selected.. What could i be doing wrong in my code please ?
View
<ul class="list-unstyled mb-0">
#foreach($permission as $value)
<li>
<label class="fancy-checkbox mb-0">
<input type="checkbox" in_array($value->id, $rolePermissions) ? true : false value="{{$value->id}}" name="permission[]">
<span>{{ $value->display_name }}</span>
-
<span>{{ $value->description }}</span>
</label>
<hr>
</li>
#endforeach
</ul>
You're missing the .blade syntax, and you should use 'checked' instead of true : false:
<input type="checkbox" value="{{ $value->id }}" name="permission[]" {{ in_array($value->id, $rolePermissions) ? 'checked' : '' }}/>
For checkboxes, simply setting checked is all that is required to determine if it should be initially checked or not.

passing a complete loop to bootstrap modal

I want to edit multi select for which i want to pass two loops to
bootstrap modal and their i want to compare id's and on that basis i will select already selected record my button
<a type="button" data-toggle="modal" data-target="#editModal{{ $value->id}}">
<span class="glyphicon glyphicon-edit"></span>
</a>
my form
<div class="form-group">
<select name="upsubject[]" multiple class="form-control">
#foreach($subject as $data)
#foreach($value->subject as $key)
<option value="{{$data->id}}" <?php if ($key->id == $data->id)
{echo
"selected";}
?>>{{$data->name}}</option>
#endforeach
#endforeach
</select>
</div>`
try this:
<option {{ ($key->id == $data->id) ? 'selected' : '' }}>{{ $data->name }}</option>
I have to detach the selected and than select new records as i am updating subjects but the above logic give me same subject three times each

how to convert select box html to form html collactive

Hi i have this in my controller
$listPatient = Patient::get();
return view('backend.consultations.create')->with([
'patient' => $this->patient,
'patient_id' =>$this->patient_id,
'listPatient' => $listPatient,
]);
and in my view i have
<div class="form-group">
<div class="col-md-2">
List clients
</div>
<div class="col-lg-10">
<select name="patient_id">
<option value="0">Veillier séléctionner un patien </option>
#foreach($listPatient as $key)
<option value="{{$key->id}}">{{$key->nom_patient}} {{$key->prenom_patient}}</option>
#endforeach
</select>
</div><!--col-lg-10-->
</div><!--form control-->
and it work fine,i want to use Form::select but it doesn't work can anyone help me please
In your controller you would want the following to fetch $listPatient
$listPatient = Patient::lists("nom_patient","id")->toArray();
and in your view you would want
{!! Form::select('patient_id', [0 => 'Veillier séléctionner un patien'] + $listPatient, null) !!}
a simple solution
enter code here : <div class ="form-group">
{{ Form::label('list_patient', trans('validation.attributes.backend.consultations.nom_patient'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
<select id="patient_id" name="patient_id" class="form-control select2 box-size" required="required" placeholder=" Non définie" >
<option value="">Non définie</option>
#foreach($listPatient as $key)
<option value ="{{$key->id}}">{{$key->nom_patient}} {{$key->prenom_patient}}</option>
#endforeach
</select>
</div><!--col-lg-3-->
</div><!--form control-->

Iam trying to make one view for add and edit in codeigniter when i try to update html elements show but when i need to use add elements hides

I am trying to make one view for add and edit in Codeigniter when I try to update HTML elements show but when I need to use additional elements hides I know the problem is that I am using foreach what can I do to make work
<?php include_once 'Header.php'; ?>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<?php if($Operation == 2){ foreach ($records as $value) :?>
<?php if($Operation == 1) {echo form_open_multipart('Slider_Controller/AddNewSlid');} else if($Operation == 2){echo form_open_multipart('Slider_Controller/UpdateSlid/'.$value->Slid_ID. ''); } ?>
<div class="form-group">
<label>Slider Title</label>
?>
<input type="text" name='SlidTitle' class="form-control" value='<?php if($Operation == 2){echo $value->Title; } else { echo ""; }?>' placeholder="Slider Title">
</div>
<div class="form-group">
<label>Upload Icone</label>
<input type="file" name='userfile'>
</div>
<div class="form-group">
<label>Description</label>
<textarea class="form-control" rows="3" name='SlidDescription'><?php if($Operation == 2){echo $value->Description; }else if($Operation == 1){ echo null;}?></textarea>
</div>
<div class="form-group">
<label>Select Slide status</label>
<select class="form-control" name='Staus'>
<option value='0'>Select status</option>
<option value='1' <?php if($Operation == 2){if ($value->Status == "1"){echo 'selected="selected"';}}?>>Active</option>
<option value='2' <?php if($Operation == 2){if ($value->Status == "2"){echo 'selected="selected"';}}?>>NonActive</option>
</select>
</div>
<?php endforeach; } ?>
<input type="submit" name='fffff' value='go'>
<button type="reset" class="btn btn-default">Reset Button</button>
<?php echo form_close(); ?>
<?php echo validation_errors('<span class="error">', '</span>'.'<br>'); ?>
</div>
<!-- /.col-lg-6 (nested) -->
<!-- /.col-lg-6 (nested) -->
</div>
<!-- /.row (nested) -->
</div>
<!-- /.panel-body -->
<?php include_once 'Footer.php'; ?>
your code only validates for $operation == 2, there is no block if $operation == 1.
You have written form for AddNewSlid inside if $operation == 2, which is never going to be true.
Rather, move out AddNewSlid form code out of $operation == 2
Try This
<?php include_once 'Header.php'; ?>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<?php
//$Operation = 1;
$records = array('Slid_ID' => 2,"Title"=>"vijay", "Description" => 'bangalore india', 'Status' => 1);
$value = json_decode(json_encode($records));// comment this line means then it work for add else for edit
// echo "<pre>";print_r($value);die;
?>
<form action="<?= 'Slider_Controller/AddNewSlid/' . (isset($value->Slid_ID) ? $value->Slid_ID : '') ?>">
<div class="form-group">
<label>Slider Title</label>
<input type="text" name='SlidTitle' class="form-control" value="<?= isset($value->Title) ? $value->Title : "" ?>" placeholder="Slider Title">
</div>
<div class="form-group">
<label>Upload Icone</label>
<input type="file" name='userfile'>
</div>
<div class="form-group">
<label>Description</label>
<textarea class="form-control" rows="3" name='SlidDescription'><?= isset($value->Description) ? $value->Description : "" ?></textarea>
</div>
<div class="form-group">
<label>Select Slide status</label>
<select class="form-control" name='Staus'>
<?php $status = isset($value->Status) ? $value->Status : '' ?>
<option value=''>Select status</option>
<option value='1' <?= ($status == "1") ? 'selected' : '' ?>>Active</option>
<option value='2' <?= ($status == "2") ? 'selected' : '' ?>>NonActive</option>
</select>
</div>
<input type="submit" name='fffff' value='go'>
<button type="reset" class="btn btn-default">Reset Button</button>
</form>
<?php echo validation_errors('<span class="error">', '</span>' . '<br>'); ?>
</div>
<!-- /.col-lg-6 (nested) -->
<!-- /.col-lg-6 (nested) -->
</div>
<!-- /.row (nested) -->
</div>
<!-- /.panel-body -->
<?php include_once 'Footer.php'; ?>
this page is for add/edit
please pass $value to edit only other wise $value should be empty
`

want to pass the post value in to controller

Here am having the code like this
<div class="form-group">
<label class="col-lg-3 control-label">Start Date</label>
<div class="col-lg-5">
<div class="input-group">
<input type="text" required name="attendance_date" id="attendance_date" class="form-control datepicker" value="<?php echo date('Y-m-d');?>" data-date-format="<?= config_item('date_picker_format'); ?>" required>
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
<a data-toggle="modal" data-target="#myModal" type="button" name="update" href="<?php echo base_url();?>admin/attendance_confirmation/reject1/<?php echo $this->input->post('attendance_date');?>" id="update1" value="Reject" class="btn btn-danger ml" ><i class="fa fa-times"></i> <?= lang('reject') ?></a>
and my controller looks like this
public function reject1($date)
{
$data['date']=$date;
var_dump($data['date']);
$data['modal_subview'] = $this->load->view('admin/engineer_attendance_confirmation/attendance_confirmation_modal',$data,FALSE);
$this->load->view('admin/_layout_modal', $data);
}
but the value in the attendance_date is not getting in controller.how can we pass the value in the post to the controller using href tag
In CodeIgniter, POST data isn't passed through as variables into the controller function. You'd instead need to use the input library. You can then use $this->input->post() to get POST data:
$data['date'] = $this->input->post('attendance_date');
Using href tag you don't get data in the post, but you can get the data using a segment like this:
public function reject1()
{
$data['date']=$this->uri->segment(3);
var_dump($data['date']);
$data['modal_subview'] = $this->load->view('admin/engineer_attendance_confirmation/attendance_confirmation_modal',$data,FALSE);
$this->load->view('admin/_layout_modal', $data);
}

Resources