[Tables reletions](http://i.stack.imgur.com/3OcHU.png)

Category.php

```
namespace App;

use Illuminate\Database\Eloquent\Model;

class Category extends Model
{

  public function getVideo(){

        return $this->hasMany('App\Video','category_id','id')->where('categories.kat_name', '=', 'comedy');

    }

}

```

PagesController.php(Controller)

```
namespace App\Http\Controllers;

use App\User;

use App\Category;

use App\Video;

use App\Http\Controllers\Controller;

class PagesController extends Controller
{

function getCategory($kategori_ad){

    $myvideo = Category::all()->getVideo();

    }

}

```

I want make this : SELECT \* FROM categories join videos ON categories.id=videos.category\_id AND categories.kat\_name='animals' with orm