2016-07-09 1 views
0

드롭 다운 목록을 올바르게 가져 오는 중입니다. 그러나 페이지를 새로 고친 후 드롭 다운 목록의 모든 값은 디 서퍼입니다.새로 고침 후 드롭 다운 목록 disapper

public function SecondLogin(Request $request){ 

    $view = property_exists($this, 'loginView') 
       ? $this->loginView : 'auth.authenticate'; 

    if (view()->exists($view)) { 
     return view($view); 
    } 
     $email1=session::pull('shop_id'); 
     $employee_email=session::pull('employee_email'); 

     $main_shop=User::with('user_details')->where('email', $email1)->first(); 
     $employee_list=session::pull('employee_list'); 
     $employee_list = User::Orwhere('id',$main_shop['id'])->Orwhere('shop_parent_id',$main_shop['id'])->where('status',1)->get(); 


    return view('auth.secondlogin')->with([ 'employee_list' => $employee_list,'email1'=>$email1,'main_shop'=>$main_shop,'employee_email'=>$employee_email]); 
} 

보기 :

<div class="form-group"> 
      <select name='employee_Id' class="form-control"> 
       <option class="category" value="" >-Select your name-</option> 
       @foreach($employee_list as $employee) 
         <option class="category" value= "{{ $employee->id }}" @if($employee_email==$employee->email) selected='selected' @endif>{!! $employee->name !!}</option> 
       @endforeach 
     </select> 
     </div> 

잘못 무슨 일이 일어나고 있는지 이해하지

여기 내 컨트롤러 코드입니다. 어떤 도움이 크게 Appriciated 것입니다.

답변

0

세션 풀은 세션에서 요소를 삭제하므로 두 번째로 세션에서 가져온 값이 null입니다.

(컨트롤러 내부에서 직접 로직 및 데이터베이스 쿼리를 수행하지 말고 리포지토리 클래스로 이동해야 함)