Exemplo n.º 1
0
 /**
  * Generates products.
  *
  * @return void
  */
 protected static function products()
 {
     foreach (self::$sellers as $seller) {
         $product = \Service_Product::create('Product Line ' . \Str::upper(\Str::random('alpha', 1)), $seller);
         if ($product) {
             for ($i = 1; $i <= 3; $i++) {
                 $option = \Service_Product_Option::create('Product ' . \Str::upper(\Str::random('alpha', 1)), $product);
                 if ($option) {
                     self::$product_options[$seller->id][] = $option;
                     \Service_Product_Option_Fee::create('Subscription', 1, 'month', mt_rand(5, 15), $option);
                 }
             }
         }
     }
     \Cli::write('Product Simulation Complete', 'green');
 }
Exemplo n.º 2
0
 /**
  * Attempts to get a product option fee from a given ID.
  *
  * @param int $id Product option fee ID.
  *
  * @return Model_Product_Option_Fee
  */
 protected function get_fee($id)
 {
     $fee = Service_Product_Option_Fee::find_one($id);
     if (!$fee || $fee->option->product->seller != Seller::active()) {
         throw new HttpNotFoundException();
     }
     return $fee;
 }