public function vendorEmail() { $vendor = Vendor::find($this->vendor_id); if ($vendor && $vendor->email) { return $vendor->email; } else { return null; } }
public function website($vendor_id) { $vendor = Vendor::find($vendor_id); if (!$vendor) { return abort(404); } if ($vendor->website) { return redirect()->away($vendor->website); } else { return abort(404); } }
/** * Lists all Vendor models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Vendor::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function includeVendor(Product $product) { $vendor = Vendor::find($product->vendor_id); return $this->item($vendor, new VendorTransformer()); }