i am trying to fetch the values from database and show it on dropdown..while i am trying this i got this error undefined variable usertype..i can't understand where is the mistake..i am new to laravel framework..
Here is my controller:
public function get() {
$usertype = DB::table('user_type')->get();
return View::make('/home')->with(compact('user_type'));
return $usertype;
}
Here is my view dropdown:
<div class="form-group">
<label for="cat">User Type</label>
<select class="form-control" name="user_type_id">
@foreach($usertype as $user)
<option id="user_type_Id" value="{{$user->id}}" selected="selected">{{ $user->type }}</option>
@endforeach
</select>
</div>
Can anyone help me..