我收到此错误消息
未定义变量:seller_type(查看:/var/www/resources/views/dash/dash.blade.php)
我无法弄清楚它的修复方法,我不确定我是否忽略了一些明显的东西。任何帮助,将不胜感激。
这是我的 dash.blade:
@if(Auth::user()->id)
<div class="row">
<div class="col-md-12">
<span>Seller Type: </span>
<select class="seller_type_select" data-type="dash">
<option value="call_center" {{$seller_type == 'call_center' ? 'selected' : ''}}>Call Center</option>
<option value="dealership" {{$seller_type == 'dealership' ? 'selected' : ''}}>Dealership</option>
</select>
</div>
</div>
@endif
这是我的控制器:
class DashboardController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function __construct()
{
setlocale(LC_MONETARY, 'en_US.utf8');
$this->middleware('acl:view_dash', ['only' => ['index']]);
}
public function index()
{
$input = Input::all();
$user_id = Auth::user()->id;
$role_id = User::UserRoleData()->where('user_id', '=', $user_id)->first();
$call_center = Auth::user()->call_center;
$call_center = ($call_center == null ? '' : $call_center);
$call_center = !empty($input['call_center']) ? $input['call_center'] : $call_center;
$month = !empty($input['month']) ? $input['month'] : 'twentyfour';
$seller_type = Auth::user()->seller_type;
$seller_type = ($seller_type == null ? '' : $seller_type);
$seller_type = !empty($input['seller_type']) ? $input['seller_type'] : 'call_center';
$companies = Company::DistinctCompanies()->orderby('name')->get();
$date = date('Y-m-d', strtotime('now -24 months'));
if($seller_type == '2')
{
return $contracts->where('type_id', '=', 'call_center');
}
elseif($seller_type == '3')
{
return $contracts->where('type_id', '=', 'dealership');
}
三国纷争
GCT1015