当用户在输入字段和搜索结果框之外单击时,如何隐藏输入字段和搜索结果框?
目前,如果您将鼠标悬停在#search-btn两者上,就会出现 和#search-container。#search-results如果您单击除#search-container两者之外的任何地方都会消失。
我希望这样我就可以点击#search-results而不让它们都消失。
小提琴:https://jsfiddle.net/emis/d2sn7q6L/
HTML:
<div id="search-container">
<form id="search-form">
<input id="search" type="search">
</form>
</div> <!-- End search-box -->
<a id="search-btn" class="search-icon" href="#">search</a>
<div id="search-results"></div> <!-- End search-results -->
Run Code Online (Sandbox Code Playgroud)
JS:
var searchInput = $("#search-container");
var searchResults = $("#search-results");
var showSearchInput = function() {
searchInput.show();
searchResults.show();
if(searchInput.is(":visible")) {
$("#search").focus();
}
};
$("#search-btn").hover(showSearchInput);
searchInput.focusout(function(e) {
searchInput.hide();
searchResults.hide();
});
Run Code Online (Sandbox Code Playgroud) 我有一种方法可以删除属于它的产品和图像,但我无法删除该图像。
我哪里出错了?
public function deleteProduct($ids)
{
foreach ($ids as $id => $value) {
$product = Product::find($id);
$productImage = $product->image_path;
if ($productImage) {
Storage::delete($productImage);
$product->destroy($id);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我在存储和公共文件夹之间有一个符号链接。
下存储图像位于例如 - storage/app/public/images/products/4/image.png
在公共下 - public/storage/images/products/4/imagep.png
图像路径在数据库中存储为 - /storage/images/products/4/ACTCMRcYlWR8Bn3ZxoJ7bpiDJ7.png
当我composer install -v在Magento 2目录中运行时,得到以下信息:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Dependency resolution completed in 0.000 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested PHP extension ext-gd * is missing from your system. Install or enable PHP's gd extension.
Problem 2
- The requested PHP extension ext-dom * is missing from your system. Install or …Run Code Online (Sandbox Code Playgroud) 有没有办法在播种表之前将自动增量设置回1?
我在播种之前清空了桌子,如果我migrate:refresh在播种之前没有做,那么它继续从最后一个位置自动增加ID,例如4.
表种子:
public function run()
{
DB::table('products')->delete();
// Product table seeder
$product = new \App\Product([
'category_id' => 1,
'image_path' => '/images/products/1/000001.jpg',
'title' => 'test',
]);
$product->save();
}
Run Code Online (Sandbox Code Playgroud)
创建表:
Schema::create('products', function (Blueprint $table) {
$table->increments('id');
$table->integer('category_id')->unsigned();
$table->foreign('category_id')->references('id')->on('categories');
$table->string('image_path');
$table->string('title');
$table->timestamps();
});
Run Code Online (Sandbox Code Playgroud) 我怎么能反转一个充满整数的数组,例如:
[1;5;8;45;54]
Run Code Online (Sandbox Code Playgroud)
至:
[54;45;8;5;1]
Run Code Online (Sandbox Code Playgroud)
我可以使用任何内置功能吗?
我尝试过使用这种方法:
Array.Reverse(arr)
Run Code Online (Sandbox Code Playgroud)
我从工具>引用添加了Mscorlib.dll,但它显示错误:语法错误.在Array.Reverse(arr)位置.
我有一个表,其中包含充当过滤器的输入字段。Orders 表和 Users 表中的值有关系。
例如:
Order Id | User Full Name | Order Price | Date |
[order filter] [user name filter] [order date filter]
Run Code Online (Sandbox Code Playgroud)
如何通过关系从用户表中过滤值?
这当然会返回错误:
public function name($name)
{
return $this->builder->where('name', 'LIKE', '%$name%')->orWhere('surname', 'LIKE', '%$name%');
}
Run Code Online (Sandbox Code Playgroud)
错误:
QueryException in Connection.php line 770:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select count(*) as aggregate from `orders` where (`name` LIKE %$name% or `surname` LIKE %$name%))
Run Code Online (Sandbox Code Playgroud) laravel ×3
php ×3
css ×2
html ×2
laravel-5.3 ×2
mysql ×2
access-vba ×1
javascript ×1
jquery ×1
nginx ×1
psd ×1
ubuntu ×1
vba ×1