/** * Handle the event. * * @param questionnairePurchased $event * @return void */ public function handle(questionnairePurchased $event) { $payment = $event->payment; $questionnaire = $payment->itemable; $payment->update(['status' => 1]); $questionnaire->update(['status' => 1]); Addon::questionnaire()->first()->buy(); }
/** * Handle the event. * * @param advertisePurchased $event * @return void */ public function handle(advertisePurchased $event) { $payment = $event->payment; $advertise = $payment->itemable; $payment->update(['status' => 1]); Advertise::where('user_id', $advertise->user_id)->where('package', $advertise->package)->update(['status' => 1]); Addon::advertise()->first()->buy(); }
/** * Handle the event. * * @param showcasePurchased $event * @return void */ public function handle(showcasePurchased $event) { $payment = $event->payment; $showcase = $payment->itemable; $payment->update(['status' => 1]); $showcase->update(['status' => 1]); Addon::showcase()->first()->buy(); }
/** * Handle the event. * * @param shopPurchased $event * @return void */ public function handle(shopPurchased $event) { $payment = $event->payment; $shop = $payment->itemable; $payment->update(['status' => 1]); $shop->update(['status' => 1]); File::makeDirectory(public_path() . '/img/files/shop/' . $shop->id, 0775, true, true); Addon::shop()->first()->buy(); }
/** * Handle the event. * * @param offerPurchased $event * @return void */ public function handle(offerPurchased $event) { $user = Auth::user(); $payment = $event->payment; $offer = $payment->itemable; $payment->update(['status' => 1]); $offer->update(['status' => 1]); Addon::offer()->first()->buy(); }
/** * Handle the event. * * @param pollPurchased $event * @return void */ public function handle(pollPurchased $event) { // $user = Auth::user(); $payment = $event->payment; $poll = $payment->itemable; $payment->update(['status' => 1]); $poll->update(['status' => 1]); Addon::poll()->first()->buy(); }
/** * Handle the event. * * @param storagePurchased $event * @return void */ public function handle(storagePurchased $event) { $user = Auth::user(); $payment = $event->payment; $storage = $payment->itemable; $payment->update(['status' => 1]); $storage->update(['status' => 1]); $user->usage->freeup($storage['capacity']); Addon::storage()->first()->buy(); }
/** * Created By Dara on 28/12/2015 * addon management admin control */ public function adminIndex(User $user) { $addons = Addon::latest()->lists('name')->toArray(); //get all addon names $validAddon = []; foreach ($addons as $addon) { $validAddon[] = "App\\" . ucfirst($addon); //create the itemable_type (APP\Shop ....) } $payments = $user->payments()->where('status', '=', 1)->whereIn('itemable_type', $validAddon)->groupBy('itemable_type')->get(); return view('admin.addon.index', compact('user', 'payments'))->with(['title' => 'User Addon Management']); }
/** * Run the database seeds. * * @return void */ public function run() { $addons = []; $addons[] = ['name' => 'storage']; $addons[] = ['name' => 'poll']; $addons[] = ['name' => 'questionnaire']; $addons[] = ['name' => 'shop']; $addons[] = ['name' => 'offer']; $addons[] = ['name' => 'advertise']; $addons[] = ['name' => 'relater']; $addons[] = ['name' => 'profit']; $addons[] = ['name' => 'showcase']; foreach ($addons as $addon) { Addon::create($addon); } }
public function showcase(Showcase $vitrin) { $user = $vitrin->user; $profile = $vitrin->profile; $visit_rate = $profile->info->num_visit / (Carbon::parse($profile->created_at)->month + 1); $showcase = Addon::showcase()->first(); $price = $this->showcasePrice($profile); return view('store.showcase', compact('user', 'profile', 'showcase', 'visit_rate', 'price', 'vitrin'))->with(['title' => 'تبلیغات در پروفایل']); }
public function showcase(Request $request) { $user = Auth::user(); $showcase = Addon::showcase()->first(); $showcase->comments()->create(['user_id' => $user->id, 'body' => $request->input('body')]); $showcase->update(['num_comment' => $showcase->comments()->count()]); Flash::success('comment sent'); return redirect()->back(); }