我正在为我的客户表构建搜索功能,由于某种原因,当我搜索具有特定手机号码的条目时,即使该数据存在,它也不会显示。我只是用我的“移动”属性来体验这个,而其他所有的都很好。
这是我的客户表架构:
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->string('firstName')->nullable();
$table->string('lastName');
$table->string('companyName');
$table->string('companyEmail')->unique();
$table->string('branch')->nullable();
$table->bigInteger('phone')->nullable();
$table->bigInteger('mobile')->nullable();
$table->string('address')->nullable();
$table->string('clientType')->nullable();
$table->string('reseller')->nullable();
$table->string('assignedTo');
$table->timestamps();
});
当我尝试在 PHPMyAdmin 上执行相同的查询时,它会检索数据:
但是在使用此代码时,它不会:
$results = Customer::where('firstName', 'like', '%'.$request->input('search-customer-fname'). '%')
->where('lastName', 'like', '%'.$request->input('search-customer-lname'). '%')
->where('companyName', 'like', '%'.$request->input('search-company-name'). '%')
->where('companyEmail', 'like', '%'.$request->input('search-company-email'). '%')
->where('branch', 'like', '%'.$request->input('search-company-branch'). '%')
->where('phone', 'like', '%'.$request->input('search-company-phone'). '%')
->where('mobile', 'like', '%'.$request->input('search-company-mobile'). '%')
->paginate(10);
这是移动输入字段的 HTML/Blade 代码:
<label for="search-company-mobile">
Mobile:
<input class="form-control" type="number" name="search-company-mobile">
</label>
任何帮助将不胜感激!