Пример #1
0
 public function vendorEmail()
 {
     $vendor = Vendor::find($this->vendor_id);
     if ($vendor && $vendor->email) {
         return $vendor->email;
     } else {
         return null;
     }
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 /**
  * Lists all Vendor models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Vendor::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Пример #4
0
 public function includeVendor(Product $product)
 {
     $vendor = Vendor::find($product->vendor_id);
     return $this->item($vendor, new VendorTransformer());
 }