Skip to content

Instantly share code, notes, and snippets.

@insign
Created January 28, 2017 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insign/af745e5aea3cf02ed6dacc4eca1b171b to your computer and use it in GitHub Desktop.
Save insign/af745e5aea3cf02ed6dacc4eca1b171b to your computer and use it in GitHub Desktop.
<?php
protected function createProduct()
{
return Product::create($this->request->all());
}
protected function applyDiscount($type, $product)
{
$discount = Discount::byType($type);
$discount->applyDiscountForProduct($product);
}
protected function notifyUsersVia($method)
{
$users = User::all();
foreach ($users as $user) {
$notification = Notification::via($method);
$notification->notifyUser($user);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment