小编Pio*_*nek的帖子

Laravel Eloquent ORM"whereHas"通过表

嘿,我和Laravel有问题.我尝试通过联系表选择有我选择的城市的地方.

我的模型类:Places类:

class Places extends Eloquent {
    public function contacts()
    {
        return $this->hasOne('Contacts');
    }
     public function clubs()
     {
        return $this->hasOne('Clubs');
     }    
}
Run Code Online (Sandbox Code Playgroud)

联系人类:

 class Contacts extends Eloquent {
     public function cities()
     {
         return $this->hasOne('Cities');
     }
   }
Run Code Online (Sandbox Code Playgroud)

城市类:

 class Cities extends Eloquent {

 }
Run Code Online (Sandbox Code Playgroud)

我的查询:

$view->clubs = Places::whereHas('contacts',function ($q) use($city_id){
           $q->where('contacts', function ($q) use($city_id){
               $q->where('id', $city_id);
            });
        })->get();
Run Code Online (Sandbox Code Playgroud)

错误消息:

MySQL服务器版本使用附近的正确的语法'其中id=))> = 1?'在1号线(SQL:SELECT*FROM places其中(SELECT COUNT(*)从contacts哪里contacts.places_id= places.idcontacts=(选择*其中id= …

sql orm laravel eloquent

8
推荐指数
1
解决办法
2万
查看次数

带有图像背景的页面的 V 形部分

我正在尝试制作一个单页网站。但我想要一些东西来使其与所有其他类似的网站多样化。我想出了制作V形截面的想法。 v形页

我希望每个部分都以一种“v”结尾。我不知道如何在 css 中实现这种效果,这样就不需要剪切作为背景的图像。我还没有在互联网上找到任何例子。这是我的尝试:HTML:

<div class="wrap" style="z-index: 9999">
    <img src="https://farm8.staticflickr.com/7187/6895047173_d4b1a0d798.jpg" />
 </div>
 <div class="wrap" style="margin-top: -40px">
      <img src="http://media-cdn.tripadvisor.com/media/photo-s/03/9b/2d/f2/new-york-city.jpg" />
 </div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.wrap {
  position: relative;
  overflow: hidden;
  width: 70%;
  height:150px;
  margin: 0 auto;
  background-color:#fff;
}
.wrap img {
   width: 100%;
   height: auto;
   display: block;
 }
 .wrap:before, .wrap:after {
    content:'';
    position: absolute;
    bottom: 0;
    width: 50%;
    background-color: inherit;
    padding-bottom:3%;
  }
 .wrap:before {
    right: 50%;
    -ms-transform-origin: 100% 100%;
    -webkit-transform-origin: 100% 100%;
    transform-origin: 100% 100%;
    -ms-transform: skewX(45deg);
    -webkit-transform: skewX(45deg);
     transform: skewX(87deg);
    }
   .wrap:after …
Run Code Online (Sandbox Code Playgroud)

html css css-shapes

4
推荐指数
1
解决办法
4555
查看次数

动画/过渡svg过滤图像元素

嘿,我在你的网站上显示了很多商业图标.我想添加与它们相关的炫酷动画.我认为图标会保持灰色,直到你将它们悬停.然后他们慢慢变色.首先,我做了这个效果filter: grayscale(100%).但是这些图标有不同的灰色阴影,看起来很糟糕.然后我找到了一个svg过滤器,如下所示.不幸的是,我不知道如何为此过滤器设置过渡效果的动画.所以我正在寻找帮助来使这个动画工作或以另一种方式来实现这样的效果.

img {
  -webkit-filter: url(#gray-filter);
  filter: url(#gray-filter);
  transition: filter 2s;
  -webkit-transition: filter 2s;
}
img:hover {
  -webkit-filter: none;
  filter: none;
}
Run Code Online (Sandbox Code Playgroud)
<svg style="position: absolute; width: 140px; height: 140px;">
  <defs>
    <filter id="gray-filter">
      <feColorMatrix type="luminanceToAlpha" result="L2A"></feColorMatrix>
      <feFlood flood-color="#b3b4bd" result="colorfield"></feFlood>
      <feBlend mode="multiply" in="L2A" in2="colorfield"></feBlend>
      <feComposite operator="in" in2="SourceGraphic"></feComposite>
    </filter>
  </defs>
</svg>
<img src="http://iconshow.me/media/images/logo/brand-logo-icon/png/128/cocacola-128.png" />
Run Code Online (Sandbox Code Playgroud)

css svg transition css-transitions css-animations

2
推荐指数
1
解决办法
3774
查看次数