コード例 #1
1
 /**
  * Process datatables ajax request.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $auth_account = $this->auth_user->account;
     //return all accounts when we are in the system account
     //in a normal account only show the current linked one
     if ($auth_account->isSystemAccount()) {
         $accounts = Account::all();
     } else {
         // retrieve the account as a collection
         $accounts = Account::where('id', '=', $auth_account->id)->get();
     }
     return Datatables::of($accounts)->addColumn('actions', function ($account) {
         $actions = \Form::open(['route' => ['admin.accounts.destroy', $account->id], 'method' => 'DELETE', 'class' => 'form-inline']);
         $actions .= ' <a href="accounts/' . $account->id . '" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-eye-open"></span> ' . trans('misc.button.show') . '</a> ';
         $actions .= ' <a href="accounts/' . $account->id . '/edit" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-edit"></span> ' . trans('misc.button.edit') . '</a> ';
         if ($account->disabled) {
             $actions .= ' <a href="accounts/' . $account->id . '/enable' . '" class="btn btn-xs btn-success"><span class="glyphicon glyphicon-ok-circle"></span> ' . trans('misc.button.enable') . '</a> ';
         } else {
             $actions .= ' <a href="accounts/' . $account->id . '/disable' . '" class="btn btn-xs btn-warning"><span class="glyphicon glyphicon-ban-circle"></span> ' . trans('misc.button.disable') . '</a> ';
         }
         $actions .= \Form::button('<i class="glyphicon glyphicon-remove"></i> ' . trans('misc.button.delete'), ['type' => 'submit', 'class' => 'btn btn-danger btn-xs']);
         $actions .= \Form::close();
         return $actions;
     })->make(true);
 }
コード例 #2
0
 /**
  * @param $name
  *
  * @return mixed
  */
 protected function findAccountByName($name)
 {
     $account = Account::where('id', $name)->orWhere('name', $name)->first();
     if ($account === null) {
         $account = Account::find(['name' => 'Default'])->first();
         if ($account === null) {
             $account = Account::all()->first();
         }
         $this->info(sprintf("No account was found for given account name so '%s' was used", $account->name));
     }
     return $account;
 }
コード例 #3
0
ファイル: ListCommand.php プロジェクト: ihatehandles/AbuseIO
 /**
  * {@inheritdoc}.
  */
 protected function findAll()
 {
     return Account::all();
 }