Laravel 5.3回归? 在哪里雄辩

I've sucessfully created many functions using where query on Laravel 5.3, but this time something weird is happening.

public function show($id){
    $artikel = Artikel::select('artikel.*','kategori.kategori_id','kategori.kategori_nama','users.name','users.user_photo','users.biodata')
            ->join('kategori','artikel.kategori_id','=','kategori.kategori_id')
            ->join('users','user_id','=','id')
            ->orderBy('view','desc')
            ->find($id);
    $kategori = Kategori::all();
    $sub = Artikel::select('kategori_id')->where('artikel_id',$id)->toSql();
    dd($sub);
    $related = Artikel::where('kategori_id','=',$sub)
                ->get();
    dd($related);
    if($artikel == null ){
        $artikel = new Artikel; 
        $artikel->pesan=0;

        foreach ($artikel as $post) {
            $this->putInCache( $post->slug, $post, 'artikel' );
        }
        return view('artikel.show')->with('artikel',$artikel)->with('kategori',$kategori);
    }

    $artikel->view+=1;
    $artikel->save();

    return view('artikel.show')->with('artikel',$artikel)->with('kategori',$kategori)->with('related',$related);
}

The method outputs an error on line 8. The dd() on line 9 returned

"select `kategori_id` from `artikel` where `artikel_id` = ?"

I've tried to change the query to

$sub = Artikel::select('kategori_id')->where('artikel_id','=',1)->toSql();

And much more, but still got an error. That line returned ? on where clause. Please help me.

Thank you!

UPADTE 1

Now the code is like this :

$related = Artikel::where('kategori_id','=','select kategori_id from artikel where artikel_id = 1')
                ->get();

and the result is returned empty collection.

Collection {#272 ▼ #items: [] }

It's not an error, ? is normal. toSql() method shows ? sign instead of values in a query.

This method is great for quickly seeing the SQL. However, it doesn’t include the query bindings, only a ? for where they are to be inserted. Depending on the complexity of the bindings, this may be enough information for you to debug it.

I've found the working. There's the code :

$sub = DB::raw('(select kategori_id from artikel where artikel_id =1)');
    $related = DB::table('artikel')->select('*')->where('kategori_id','=',($sub))->get();
    dd($related);