Exemplo n.º 1
0
 public function redirectToDashboardAdmin()
 {
     if (Auth::guest()) {
         flash()->error('Your session is timed out. Please login and confirm again.');
         return Auth::guest('/login');
     }
     $user = User::find(Auth::user()->id);
     if ($user) {
         if ($user->email == config('mail.admin.address')) {
             /*
              * View Plan for subscription
              * Using laravel cashier for plan retrieval
              * Method call from Route::get('/dashboard/vendor/plan', [ 'uses' => 'UserController@redirectToVendorPlan', 'as' => 'vendor.plan' ]);
              * */
             $plan = StripePlan::where('active', '=', '1')->get();
             $response = view('super-admin.dashboard', compact('plan'))->with('user', Auth::user())->with('authenticated', Auth::check());
             if (session()->has('approvals')) {
                 $approvals = session('approvals');
                 return $response->withApprovals($approvals)->withTotalApprovals($this->totalApprovals($approvals, ['categories', 'products', 'stores']));
             }
             return $response;
         }
         if ($user->stores()->count() == 0) {
             return redirect()->route('user::customer.dashboard');
         }
         return redirect()->route('user::vendor.dashboard');
     }
     return redirect('/');
 }
Exemplo n.º 2
0
 public function updateStatus(Request $data)
 {
     $all_data = $data->all();
     $id = $all_data['plan'];
     $plan = StripePlan::where('plan_id', $id)->update(['active' => $all_data['confirm_action']]);
     return Response::json(['plan_id' => $id, 'confirm' => $all_data['confirm_action']]);
 }
Exemplo n.º 3
0
 public function getFeature($plan_id, $feature_name)
 {
     if ($plan_id != null) {
         $feature = StripePlan::with('planFeature')->where('plan_id', '=', $plan_id)->first();
         return in_array($feature_name, array_column(isset($feature) ? $feature->planFeature->toArray() : [], 'feature_name'));
     }
     return false;
 }