Esempio n. 1
0
 public static function assignIP($user_id, $ip_id)
 {
     DB::transaction(function () use($user_id, $ip_id) {
         $framed_ip = SubnetIP::findOrFail($ip_id);
         SubnetIP::where('user_id', $user_id)->update(['user_id' => NULL]);
         $framed_ip->user_id = $user_id;
         $framed_ip->assigned_on = date('Y-m-d H:i:s');
         if (!$framed_ip->save()) {
             throw new Exception("Could not assign IP.");
         }
     });
 }
Esempio n. 2
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('json/get-ip-list/{id}', ['as' => 'subnet.ip.list', function ($subnet_id) {
    $list = SubnetIP::where('subnet_id', $subnet_id)->whereNull('user_id')->lists('ip', 'id');
    foreach ($list as $id => $ip) {
        $ips[$id] = long2ip($ip);
    }
    return Response::json($ips);
}]);
Route::get('send-email', 'SystemController@sendEmail');
Route::get('/', ['as' => 'welcome.user', function () {
    return Redirect::route('user.panel');
}]);
Route::get('admin', ['as' => 'welcome.admin', function () {
    return Redirect::to('admin-panel');
}]);
Route::get('admin/login', ['as' => 'admin.login.form', 'uses' => 'LoginController@getAdmin']);
Route::post('admin/login', ['as' => 'admin.login', 'uses' => 'LoginController@postAdmin']);
Route::get('internet/login', ['as' => 'internet.login.form', 'uses' => 'LoginController@getInternetLogin']);
Route::post('internet/login', ['as' => 'internet.login', 'uses' => 'LoginController@postInternetLogin']);
Route::post('internet/authorize', ['as' => 'internet.login.authorize', 'uses' => 'LoginController@postAuthorizeInternetLogin']);
 public function getActiveServices($user_id)
 {
     $profile = Subscriber::findOrFail($user_id);
     $plan = Subscriber::getActiveServices($profile);
     $framedIP = SubnetIP::where('user_id', $user_id)->first();
     $framedRoute = UserRoute::where('user_id', $user_id)->first();
     switch ($profile->plan_type) {
         case FREE_PLAN:
         case PREPAID_PLAN:
             $rc_history = Voucher::where('user_id', $user_id)->leftJoin('voucher_limits as l', 'l.id', '=', 'limit_id')->paginate(5);
             return View::make("admin.accounts.services")->with('profile', $profile)->with('rc_history', $rc_history)->with('plan', $plan)->with('framedIP', $framedIP)->with('framedRoute', $framedRoute);
             break;
         case ADVANCEPAID_PLAN:
             $rproducts = APRecurringProduct::where('user_id', $profile->id)->get();
             $nrproducts = APNonRecurringProduct::where('user_id', $profile->id)->get();
             return View::make('admin.accounts.services-ap2')->with('profile', $profile)->with('plan', $plan)->with('framedIP', $framedIP)->with('framedRoute', $framedRoute)->with('rproducts', $rproducts)->with('nrproducts', $nrproducts);
             break;
     }
 }
 public function getDeleteIp($ip_id)
 {
     SubnetIP::where('id', $ip_id)->update(['user_id' => NULL]);
     $this->notifySuccess("Static IP de-assigned.");
     return Redirect::back();
 }