我已经在数据库查询上构建了一个过滤器,现在我想让它更舒适。目标是使其动态化,这意味着用户可以选择组合任意数量的组合。
public function filter(FilterList $request)
{
$view = view('profile.browse.list');
$search = $request->get('filter');
$filter = [
'male' => Profile::male(),
'female' => Profile::female(),
'10' => Profile::man(),
'11' => Profile::women(),
'12' => Profile::couple(),
'15' => Profile::domina(),
'20' => Profile::affaire(),
'21' => Profile::cybersex(),
'22' => Profile::marriage(),
'23' => Profile::flirt(),
];
return $view->with([
'List' => $filter[$search]->unmoderated()->paginate(15)->appends(['filter' => $search]),
]);
}
Run Code Online (Sandbox Code Playgroud)
我知道我的解决方案并不是一个真正好的解决方案。我已将查询范围保存在 $filter 数组中,并且无法像这样添加第二个或第三个范围
$users = User::popular()->women()->orderBy('created_at')->get();
http://laravel.com/docs/5.0/eloquent#query-scopes
有没有人给我一些提示,让我做得更好。
我不知道该开始...
谢谢你的帮助
编辑
public function scopeMarriage($query)
{
return $query->where('LookFor', 'LIKE', '%Ehe%');
}
Run Code Online (Sandbox Code Playgroud) 我在twitters引导程序上遇到了问题。我想在我的项目中使用阴影盒,但是它没有用。当我将box-shadow命令放在css文件中的相关类下时,什么也没发生。
阴影应位于标题,导航栏和内容下方,它应像图片一样工作。
http://www.directupload.net/file/d/3889/it2wsmgr_jpg.htm
*{
border-radius: 0 !important;
-moz-border-radius: 0 !important;
}
.navbar-header {
height: 247px;
background: black;
-webkit-box-shadow: 7px 7px 2px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 7px 7px 2px 0px rgba(50, 50, 50, 0.75);
box-shadow: 7px 7px 2px 0px rgba(50, 50, 50, 0.75);
}
.navbar {
height:74px;
background:#F7a717;
/* Muss überschrieben werden, sonst ist ein Abstand zwischen den Spalten */
margin:0px;
position: relative;
}
.nav {
font-size: 26px;
}
.nav li {
display:inline-block;
}
.nav li a:hover {
background:yellow; …Run Code Online (Sandbox Code Playgroud)我使用 Laravel/Lumen Shield 扩展进行 Http 身份验证,但是在我的本地计算机上一切都很完美,我只在我们的服务器上遇到了问题。
\n\n问题是在我提交正确的登录数据后,登录屏幕再次出现。我尝试了不同的登录数据、不同的浏览器,登录屏幕一次又一次出现。
\n\n我检查的最后一件事是更改我的 .htaccess:
\n\nRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]\nRun Code Online (Sandbox Code Playgroud)\n\n但我只得到了 404...
\n\n如果我使用 htaccess/htpasswd,则 Http Auth 过程可以工作,但我想用 PHP 处理这个问题,首先我想了解问题出在哪里。
\n\n为了限制这个问题,我尝试使用以下代码进行 PHP Http Auth:
\n\n <?php\n$realm = \'Gesch\xc3\xbctzter Bereich\';\n\n// Benutzer => Passwort\n$benutzer = array(\'admin\' => \'mypass\', \'gast\' => \'gast\');\n\nif (empty($_SERVER[\'PHP_AUTH_DIGEST\'])) {\n header(\'HTTP/1.1 401 Unauthorized\');\n header(\'WWW-Authenticate: Digest realm="\' . $realm .\n \'",qop="auth",nonce="\' . uniqid() . \'",opaque="\' . md5($realm) .\n \'"\');\n\n die(\'Text, der gesendet wird, falls der Benutzer auf Abbrechen dr\xc3\xbcckt\');\n}\n\n// Analysieren der Variable …Run Code Online (Sandbox Code Playgroud) 我是 python 新手,出现以下错误:
ModuleNotFoundError: 没有名为“客户端”的模块
我的项目结构如下:
我的项目:
.. 客户端(包)
... 应用程序.py
... main.py
... __init__.py
我的代码:
"""main.py"""
from Client import Application
app = Application()
app.start()
"""Application.py"""
class Application:
def start(self):
self.loop()
def loop(self):
while True:
pass
Run Code Online (Sandbox Code Playgroud)
谁能解释为什么 interpeter 找不到我的模块?
我正在寻找一种方法来选择包含"copyright"作为属性值的所有div.
我试过这样的.
https://jsfiddle.net/f87ggqg6/
[name*="copyright"] {
background:red;
}
Run Code Online (Sandbox Code Playgroud)
但我只能选择具有版权的类别,或者我可以选择具有版权的ID.有没有办法在一个语句中选择id和class?
感谢帮助.