Laravel Option Select - Default Issue

SA__

Here is my Select Box, Here All Company will be loaded,

But i want to display the Particular company as default selected which i have it in session.

Here is my Code

$sessioncompany = 'ABCcompany'
$comp[''] = 'Company';
@foreach($company_list as $row) 
        <?php
        $comp[$row->CompanyID] = $row->CompanyName;
        ?>
        @endforeach 
 {{ Form::select('CompanyID', $comp, '', array('id' => 'seCompanyID')); }}

What i tried is

 {{ Form::select('CompanyID', $comp, '', array('id' => 'seCompanyID'), array(id=>$sessioncompany)); }}

But i ended with failure

What is the mistake i am doing and How can i fix that ?

Note : I want it in the native laravel method

Jarek Tkaczyk
$selectedId = ... // get the id from the session
{{ Form::select('CompanyID', $comp, array($selectedId), array('id' => 'seCompanyID')) }}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Laravel Option Select - Default Issue

From Dev

Laravel - Select - set Default option

From Dev

Issue not having a selected default option while populating select with ajax

From Dev

Laravel: Form select not working with style / class when setting the default option

From Java

default select option as blank

From Dev

HTML <select> default option

From Dev

default setting for option select

From Dev

Issue with Select after prepending option

From Dev

Issue in select option in Jquery mobile

From Dev

javascript - select option jquery issue

From Dev

Select option overlay issue in materialize

From Dev

jquery event issue with select option

From Dev

Angular 2, select option issue

From Dev

Select Box Option width Issue

From Dev

add default option to angularjs select

From Dev

change color of default option in select

From Dev

Jquery select option default option text

From Dev

Laravel Eloquent Select Issue

From Dev

Laravel Eloquent Select Issue

From Dev

Issue with select default value of select menu in Jquery?

From Dev

AngularJS : how to create select option and set default select option?

From Dev

select option not working laravel 5.4

From Dev

issue with change function on select option in Jquery

From Java

Set default option in mat-select

From Dev

Rails form_for select default option

From Dev

Select default option not working with Ionic Framework

From Dev

Set default value of select to null option

From Dev

Yii2 dropdownList select default option

From Java

How to show disable HTML select option in by default?