我想向下面的HTML显示ajax响应,其中最初的0可用插槽可以在ajax响应上更改.并基于数据响应dropdown_wrapper class <li>将自动出现.我如何让它充满活力?
<span class="selected_item">0 available Slots</span>
<div class="form_item_dropdown">
<div class="dropdown_wrapper">
<li class="timeSlot" id="time1">
<i class="icon fa fa-clock-o" aria-hidden="true">
</i>
<span class="item_title">10am - 4pm (value comes through Ajax)</span>
</li>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
Ajax代码:
$(".school_title").on("click", function (argument) {
var id = $(this).attr('id');
var info=$.get("{{url('school-slot')}}",{id:id});
info.done(function(data){
console.log(data.length);
/* $.each(data,function(index,subcatObj){
}); */
});
});
Run Code Online (Sandbox Code Playgroud)
以下是回复:
{id: 3, school_id: 3, break_time: "10am - 8pm"}
{id: 4, school_id: 3, break_time: "10am - 4:30pm"}
Run Code Online (Sandbox Code Playgroud) 我想验证用户信息,如出生日期,因为我在验证中使用了以下语句行,但是我如何使其动态化,以便用户的最小年龄可能是 13。低于该年龄无法注册?
return Validator::make($data, [
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6',
'date_of_birth' =>'required|date|before:2011-06-08',
]);
Run Code Online (Sandbox Code Playgroud) 我试图找到不是免费产品并且产品状态处于活动状态的产品,即 1 但问题是它在以下查询中无法按我想要的方式工作。它为产品系列提供了非活动和免费的我想要的匹配项。如何通过修改以下查询来获得适当的输出?这$query是搜索关键字
$products = DB::table('products')
->where('products.name' , 'like', '%'.$query.'%')
->orWhere('products.tags','like','%'.$query.'%')
->where('products.status','=',1)
->where('products.price','!=',0)
->groupBy('products.id')
->latest()
->paginate(3);
Run Code Online (Sandbox Code Playgroud) 我试图显示一个基于 url 的搜索框,意味着对于特定路线,它将显示搜索框,否则不会显示。为此我使用了Request::path(). 但问题是对于某些路线它不起作用。假设我有两条路线,例如
Route::get('products','abcontroller@index');
Route::get('product/{name}','abcontroller@searchProduct');
Run Code Online (Sandbox Code Playgroud)
现在如果我使用以下代码:
@if(Request::path() == 'products' || Request::path() == 'product/{name}')
// something print
@endif
Run Code Online (Sandbox Code Playgroud)
对于products路线,我可以看到搜索框,但product/{name}我看不到..我该如何解决这个问题?
我已将我的项目上传到我的主机上。但是当我尝试访问表单 url 时,出现以下错误
Run Code Online (Sandbox Code Playgroud)QueryException in Connection.php line 647: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
我更改了 .env 的以下凭据
DB_DATABASE=cpanel_database
DB_USERNAME=cpanel_db_name
DB_PASSWORD=cpanel_db_password
Run Code Online (Sandbox Code Playgroud)
出现上述错误可能是什么错误?