access laravel eloquent relation in js

JavaScript
Product::where(['product_id'=>$id])->with('category')
->with('user')
->with('productbrand.brand')  // product has onetomany relation 'productbrand'
//with table productbrand and productbrand has onetoone relation 'brand'
//with table brand
->first();
Source

Also in JavaScript: