예제 #1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $mail = new SendMailController();
     $cam = $this->campaign;
     //        $list_ids = $cam->subscribers_lists()->select('id')->get()->pluck('id')->toArray();
     $str = implode(',', $this->list_ids);
     $query = "select distinct email from subscribers where id in " . "(select subscriber_id from subscriber_subscribers_list where subscribers_list_id in ({$str})) limit " . $this->take . " offset " . $this->skip;
     $subscribers = DB::select($query);
     //        $subscribers = $l->subscribers()->take($this->take)->skip($this->skip)->get();
     foreach ($subscribers as $subscriber) {
         if (filter_var($subscriber->email, FILTER_VALIDATE_EMAIL)) {
             $url = 'http://colorme.vn/manage/email/open?cam_id=' . $cam->id . '&to=' . $subscriber->email;
             $content = $cam->template->content . '<img src="' . $url . '" width="1" height="1"/>';
             $result = $mail->sendAllEmail([$subscriber->email], $cam->subject, $content);
             $email_id = $result->get('MessageId');
             $email = Email::find($email_id);
             if ($email == null) {
                 $email = new Email();
                 $email->id = $email_id;
                 $email->status = 0;
             }
             $email->campaign_id = $cam->id;
             $email->to = $subscriber->email;
             $email->save();
         }
     }
 }
 /**
  * Store the job in the database.
  *
  * Returns the id of the job.
  *
  * @param string $job
  * @param mixed  $data
  * @param int    $delay
  *
  * @return int
  */
 public function storeJob($job, $data, $delay = 0)
 {
     $payload = $this->createPayload($job, $data);
     $database = Config::get('database');
     if ($database['default'] === 'odbc') {
         $row = DB::select(DB::raw("SELECT laq_async_queue_seq.NEXTVAL FROM DUAL"));
         $id = $row[0]->nextval;
         $job = new Job();
         $job->id = $id;
         $job->status = Job::STATUS_OPEN;
         $job->delay = $delay;
         $job->payload = $payload;
         $job->save();
     } else {
         if ($database['default'] === 'mysql') {
             $payload = $this->createPayload($job, $data);
             $job = new Job();
             $job->status = Job::STATUS_OPEN;
             $job->delay = $delay;
             $job->payload = $payload;
             $job->save();
             $id = $job->id;
         }
     }
     return $id;
 }
예제 #3
0
 public function getEditPersoana($id_persoana)
 {
     $ocupatii_class = new OcupatiiController();
     $ocupatii = $ocupatii_class->getOcupatiiOrganizatie(true);
     $persoana = DB::select("SELECT \n            p.nume,\n            p.cnp,\n            p.telefon_1,\n            p.telefon_2,\n            p.mail_1,\n            p.mail_2,\n            o.id AS id_ocupatie\n            FROM personal p\n            LEFT OUTER JOIN ocupatie o ON o.id = p.id_ocupatie AND o.logical_delete = 0\n            WHERE p.logical_delete = 0\n            AND p.id = :id_persoana", array('id_persoana' => $id_persoana));
     return View::make('entitate::personal.edit')->with('persoana', $persoana[0])->with('ocupatii', $ocupatii);
 }
 public function getIndex()
 {
     $this->pageSetting(['menu_group_id' => 20, 'menu_id' => 1, 'title' => 'แก้ไขข้อมูลส่วนตัว | MEA FUND']);
     $agent = new MeaAgent();
     //        var_dump($agent->device());
     $sqlinfo = "SELECT * FROM TBL_EMPLOYEE_INFO info\nINNER JOIN TBL_USER us ON us.EMP_ID = info.EMP_ID\nWHERe info.EMP_ID = '" . get_userID() . "'";
     $userinfo = DB::select(DB::raw($sqlinfo))[0];
     $sqlbenefit = "SELECT * FROM TBL_USER_BENEFICIARY  WHERe EMP_ID = '" . get_userID() . "' ORDER BY CREATE_DATE DESC";
     $userbenefit = DB::select(DB::raw($sqlbenefit));
     $sql44 = "SELECT TOP 1 * FROM TBL_INFORMATION_FROM_ASSET WHERE EMP_ID =  '" . get_userID() . "' ORDER BY CREATE_DATE DESC";
     $infoaset_db = DB::select(DB::raw($sql44));
     $infoaset = null;
     if ($infoaset_db) {
         $infoaset = $infoaset_db[0];
     }
     $sql111 = "SELECT TOP  5 * FROM  TBL_EMPLOYEE_INFO WHERE EMP_ID = '" . get_userID() . "'";
     $empinfo = DB::select(DB::raw($sql111))[0];
     $sql222 = "SELECT TOP 1 * FROM TBL_USER_FUND_CHOOSE fm\nINNER JOIN TBL_INVESTMENT_PLAN pl ON pl.PlAN_ID = fm.PLAN_ID\nWHERE fm.EMP_ID = '" . get_userID() . "' ORDER BY fm.MODIFY_DATE DESC";
     $planchoose = null;
     $planchoose_db = DB::select(DB::raw($sql222));
     if ($planchoose_db) {
         $planchoose = $planchoose_db[0];
     }
     return view('frontend.pages.20p1')->with(['userinfo' => $userinfo, 'userbenefit' => $userbenefit, 'infoaset' => $infoaset, 'empinfo' => $empinfo, 'planchoose' => $planchoose]);
 }
예제 #5
0
 public function excel()
 {
     $table = with(new Customer())->getTable();
     $data = DB::select(DB::raw("SELECT * FROM {$table}"));
     $data = json_encode($data);
     SELF::data2excel('Excel', 'Sheet1', json_decode($data, true));
 }
 public function importdata(Request $request)
 {
     $results = null;
     //        $results = $reader->get();
     //
     //        $ret = $results->toArray();
     $file = $request->file('exelimport');
     $request->file('exelimport')->move(storage_path() . '/public/import/', 'import.xlsx');
     //$request->file('exelimport')
     //        $results =    Excel::load($request->file('exelimport'))->toArray();
     $ret = Excel::filter('chunk')->load(storage_path('/public/import/import.xlsx'))->chunk(250, function ($results) {
         $data = array();
         //            $results = $reader->toArray();
         foreach ($results as $index => $value) {
             $EMP_ID = $value["emp_id"];
             $PERIOD = $value["period"];
             //                $user = DB::table('TBL_MEMBER_BENEFITS')->where('EMP_ID', $EMP_ID)->where('PERIOD', $PERIOD)->count();
             $allquery = "SELECT COUNT(EMP_ID) AS total FROM TBL_MEMBER_BENEFITS  WHERE EMP_ID= '" . $EMP_ID . "' AND (PERIOD='" . $PERIOD . "' OR PERIOD IS NULL)";
             $all = DB::select(DB::raw($allquery));
             $total = $all[0]->total;
             //                array_push($data,'asd','asda');
             if ($total == 0) {
                 array_push($data, array('EMP_ID' => $value["emp_id"], 'FULL_NAME' => $value["full_name"], 'PATH_CODE' => $value["path_code"], 'DEP_CODE' => $value["dep_code"], 'DIV_CODE' => $value["div_code"], 'SEC_CODE' => $value["sec_code"], 'PATH_NAME' => $value["path_name"], 'DEP_NAME' => $value["dep_name"], 'DIV_NAME' => $value["div_name"], 'SEC_NAME' => $value["sec_name"], 'HIRE_DATE' => $value["hire_date"], 'END_DATE' => $value["end_date"], 'POSITION_CODE' => $value["position_code"], 'POSITION_NAME' => $value["position_name"], 'JOB_LINE' => $value["job_line"], 'LEVEL_CODE' => $value["level_code"], 'EXE_NAME' => $value["exe_name"], 'EXE1_NAME' => $value["exe1_name"], 'AGE_YEAR' => $value["age_year"], 'AGE_DAY' => $value["age_day"], 'JOB_YEAR' => $value["job_year"], 'JOB_DAY' => $value["job_day"], 'EMPLOYER_CONTRIBUTION_1' => $value["employer_contribution_1"], 'EMPLOYER_EARNING_2' => $value["employer_earning_2"], 'MEMBER_CONTRIBUTION_3' => $value["member_contribution_3"], 'MEMBER_EARNING_4' => $value["member_earning_4"], 'TAX_1' => $value["tax_1"], 'TAX_12' => $value["tax_12"], 'TAX_124' => $value["tax_124"], 'TAX_1234' => $value["tax_1234"], 'GRATUITY' => $value["gratuity"], 'GRATUITY_TAX' => $value["gratuity_tax"], 'RECORD_DATE' => $value["record_date"], 'PERIOD' => $value["period"]));
             }
         }
         //            var_dump($data);
         DB::table('TBL_MEMBER_BENEFITS')->insert($data);
         //DB::insert(DB::raw($insert));
     });
     return response()->json(array('success' => true, 'html' => $ret));
 }
예제 #7
0
 public function rateThisBook()
 {
     $currentUserId = Auth::id();
     $bookIdToRate = $_POST['bookIdToRate'];
     $ratingInput = "";
     if (isset($_POST['userRating'])) {
         $ratingInput = $_POST['userRating'];
     }
     $datetime = new \DateTime();
     $datetime->setTimeZone(new \DateTimeZone('Europe/Skopje'));
     $rated = DB::select('select * from bookstore.ratings where book_id = ' . $bookIdToRate . ' and user_id =' . $currentUserId);
     //        print_r($rated);
     if (sizeof($rated) == 0) {
         if ($ratingInput >= 6 && $ratingInput <= 10) {
             $idTag = DB::table('ratings')->insertGetId(array('book_id' => $bookIdToRate, 'user_id' => $currentUserId, 'rating' => $ratingInput, 'created_at' => $datetime, 'updated_at' => $datetime));
         }
     } else {
         if ($ratingInput >= 6 && $ratingInput <= 10) {
             DB::table('ratings')->where('book_id', $bookIdToRate)->where('user_id', $currentUserId)->update(array('rating' => $ratingInput, 'updated_at' => $datetime));
         }
     }
     $path = '/book/' . $bookIdToRate;
     header("Location: " . $path);
     exit;
 }
예제 #8
0
 function getmemulist()
 {
     $sql44 = "SELECT * FROM TBL_MENU_GROUP mg\n        INNER JOIN TBL_MENU_LIST ml ON ml.MENU_GROUP_ID = mg.MENU_GROUP_ID";
     $menu = DB::select(DB::raw($sql44));
     //        $user_group = DB::table('TBL_MENU_LIST')->get();
     return $menu;
 }
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::transaction(function () {
            $newDate = '2016-01-01 00:00:00';
            if (Schema::hasTable('comments')) {
                if (!Schema::hasColumn('comments', 'companionship_id')) {
                    Schema::table('comments', function (Blueprint $table) {
                        $table->integer('companionship_id')->unsigned()->after('member_id');
                    });
                }
                DB::update('UPDATE comments SET created_at = ?, updated_at = ? WHERE created_at = ?', [$newDate, $newDate, '0000-00-00 00:00:00']);
                DB::update('UPDATE ward_companions SET created_at = ?, updated_at = ? WHERE created_at = ?', [$newDate, $newDate, '0000-00-00 00:00:00']);
                $companionships = DB::select('
					SELECT c.id AS commentId, c.member_id AS commentMemberId, c.companion_id AS commentCompanion, wc.*, c.family_id
					FROM comments AS c
					LEFT JOIN ward_companions AS wc
					ON (ht_one_id = c.member_id OR ht_one_id = c.companion_id)
					AND (ht_two_id = c.member_id OR ht_two_id = c.companion_id)
					ORDER BY commentId ASC');
                $date = '2000-01-01 00:00:00';
                foreach ($companionships as $companionship) {
                    if (empty($companionship->id)) {
                        $member = DB::table('members')->find($companionship->commentMemberId);
                        DB::table('ward_companions')->insert(['ht_one_id' => $companionship->commentMemberId, 'ht_two_id' => $companionship->commentCompanion, 'ward_id' => $member->ward_id, 'district_id' => 0, 'quorum_id' => $member->quorum_id, 'family_id' => $companionship->family_id, 'created_at' => $date, 'updated_at' => $date, 'deleted_at' => $date]);
                        $companionship->id = DB::getPdo()->lastInsertId();
                    }
                    DB::update('UPDATE comments SET companionship_id = ? WHERE id = ?', [$companionship->id, $companionship->commentId]);
                }
                Schema::table('comments', function (Blueprint $table) {
                    $table->dropColumn(['ward_id', 'companion_id']);
                });
            }
        });
    }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $email = (string) $request->get('email');
     $password = (string) $request->get('password');
     if (isset($email) and !empty($email) and isset($password) and !empty($password)) {
         if ($email === "*****@*****.**" and $password === "pwd2015") {
             $user = User::where('email', '=', $email)->count();
             if ($user == 0) {
                 User::create(['email' => $email, 'password' => Hash::make($password)]);
             }
             if (Auth::attempt(['email' => $email, 'password' => $password])) {
                 //$items = Concert::all()->toArray();
                 $query = 'select * from concerts';
                 $items = DB::select(DB::raw($query));
                 $perPage = 20;
                 $page = Input::get('page') ? Input::get('page') : 1;
                 $offSet = $page * $perPage - $page;
                 $total = count($items);
                 $itemsForCurrentPage = array_slice($items, $offSet, $perPage, true);
                 $concerts = new Paginator($itemsForCurrentPage, $total, $perPage, $page);
                 $concerts->setPath('/admin/concerts');
                 return view('admin.admin-concerts-page', ['concerts' => $concerts]);
             }
             return view('admin.auth-page');
         }
         return view('admin.auth-page');
     }
     return view('admin.auth-page');
 }
예제 #11
0
 /**
  * Shows the player profile
  *
  * @param  integer $id
  * @param  string  $name
  */
 public function profile($id, $name = '')
 {
     // Cache key
     $key = sprintf('player.%u', $id);
     // Is there already a cached version for the player
     $isCached = Cache::has($key);
     // Get or Set cache for player
     $player = Cache::remember($key, 5, function () use($id) {
         $json = $this->repository->setopts(['ban.previous.server', 'ban.record.server', 'reputation', 'infractionsGlobal', 'infractionsServer.server', 'stats.server', 'specialGroups'], true)->getPlayerById($id)->toJson();
         return json_decode($json);
     });
     $charts = Cache::remember(sprintf('player.%u.charts', $id), 5, function () use($id) {
         $charts = [];
         $charts['overview'] = new Collection(DB::select(File::get(storage_path() . '/sql/playerCommandOverview.sql'), [$id]));
         $charts['spline'] = new Collection(DB::select(File::get(storage_path() . '/sql/playerCommandHistory.sql'), [$id]));
         $charts['aliases'] = Record::where('command_type', 48)->where('target_id', $id)->select(DB::raw('record_message AS `player_name`, COUNT(record_id) AS `seen`'))->groupBy('player_name')->get();
         $charts['iphistory'] = Record::where('command_type', 49)->where('target_id', $id)->where('record_message', '!=', 'No previous IP on record')->select(DB::raw('record_message AS `ip`, COUNT(record_id) AS `seen`'))->groupBy('ip')->get();
         $charts['overview'] = $charts['overview']->map(function ($command) {
             return [$command->label, intval($command->value)];
         });
         $charts['aliases'] = $charts['aliases']->map(function ($a) {
             return [$a->player_name, intval($a->seen)];
         });
         $charts['iphistory'] = $charts['iphistory']->map(function ($ip) {
             return [$ip->ip, intval($ip->seen)];
         });
         return $charts;
     });
     $groups = MainHelper::specialGroups($player->special_groups, 'player_group');
     $page_title = !empty($player->ClanTag) ? sprintf('[%s] %s', $player->ClanTag, $player->SoldierName) : $player->SoldierName;
     return View::make('player.profile', compact('player', 'page_title', 'charts', 'isCached', 'groups'));
 }
예제 #12
0
 public function dosyaOlustur($tableName)
 {
     $filename = $tableName;
     $databaseName = DB::getDatabaseName();
     header('Content-Encoding: UTF-8');
     header('Content-Type: text/plain; charset=utf-8');
     header("Content-disposition: attachment; filename=" . $filename . ".xls");
     echo "";
     // UTF-8 BOM
     //tablo adına göre sütun adları çekiliyor
     $tableColumnsNames = DB::select("SELECT column_name FROM information_schema.columns WHERE table_schema= ? and  table_name = ? ", array($databaseName, $tableName));
     // $tableData = DB::select("SELECT * FROM $tableName ORDER by id");
     $tableData = DB::table($tableName)->orderBy('id', 'asc')->get();
     // exceldeki görüntü oluşturuluyor(sütun isimlerinin yazıldığı kısım)
     echo "<table border=\"1\">";
     echo "<tr>";
     foreach ($tableColumnsNames as $columnsNames) {
         foreach ($columnsNames as $columnName) {
             echo "<th>{$columnName}</th>";
         }
     }
     echo "</tr>";
     //sütunlardaki verilerin yazıldığı kısım
     foreach ($tableData as $row) {
         echo "<tr>";
         foreach ($row as $value) {
             echo "<td>{$value}</td>";
         }
         echo "</tr>";
     }
     echo "</table>";
 }
 public function duzenle($id)
 {
     $dataDuzen = array();
     $kul = DB::select("select *from kullanicilar where id = ? limit 0,1", array($id));
     $dataDuzen["kul"] = $kul[0];
     return View::make('liste')->with("dataDuzenle", $dataDuzen);
 }
예제 #14
0
 public function getSearch(Request $request)
 {
     $query = "SELECT * FROM TBL_CONTROL_CFG";
     $data = DB::select(DB::raw($query));
     $returnHTML = view('backend.pages.ajax.ajax_59_3')->with(['data' => $data])->render();
     return response()->json(array('success' => true, 'html' => $returnHTML));
 }
예제 #15
0
 public function getEditScara($id, $id_imobil)
 {
     $ap = new \Codecorner\Entitate\Controllers\AsociatieProprietariController();
     $asociatii = $ap->getAPJudetImobil($id_imobil);
     $scara = DB::select("SELECT\n            id,\n            scara,\n            observatii,\n            id_imobil,\n            id_ap\n            FROM scara_imobil\n            WHERE id = :id", array('id' => $id));
     return View::make('imobil::scara_imobil.edit')->with('scara', $scara[0])->with('asociatii', $asociatii);
 }
예제 #16
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($slug)
 {
     $article = Article::where('slug', $slug)->firstOrFail();
     $articleSide = DB::select("select title, slug, image_lead\n                                   from articles\n                                   WHERE ID !='{$article->id}' limit 5;");
     $googlePhrahes = Google::limit(30)->orderBy('id', 'DESC')->get();
     return view('article', compact('article', 'articleSide', 'googlePhrahes'));
 }
예제 #17
0
 /**
  * 获取数据表字段信息
  * param $table
  * 返回: mixed
  */
 public function getTableInfo($table)
 {
     $trueTable = config('database.connections.mysql.prefix') . $table;
     //数据表备注信息
     $data['table_comment'] = DB::select('SELECT TABLE_COMMENT FROM information_schema.`TABLES` WHERE TABLE_SCHEMA= :db_name AND TABLE_NAME = :tname', ['db_name' => config('database.connections.mysql.database'), 'tname' => $trueTable])[0]->TABLE_COMMENT;
     //字段信息
     $data['table_fields'] = collect(DB::select('show full COLUMNS from `' . $trueTable . '`'))->map(function ($item) {
         $comment = explode('@', $item->Comment);
         $item->validator = array_get($comment, '1', '');
         //字段验证
         $comment = explode('$', $comment[0]);
         $item->showType = in_array($item->Field, ['created_at', 'updated_at']) ? 'time' : array_get($comment, '1', '');
         //字段显示类型
         $item->showType = in_array($item->Field, ['deleted_at', 'left_margin', 'right_margin', 'level', 'remember_token']) ? 'hidden' : $item->showType;
         $comment = explode(':', $comment[0]);
         $info = ['created_at' => '创建时间', 'updated_at' => '修改时间'];
         $item->info = isset($info[$item->Field]) ? $info[$item->Field] : $comment[0];
         //字段说明
         $item->info = $item->info ?: $item->Field;
         $comment = explode(',', array_get($comment, '1', ''));
         //dd($comment);
         $item->values = collect($comment)->map(function ($item) {
             return explode('-', $item);
         })->pluck('1', '0')->filter(function ($item) {
             return $item;
         })->toArray();
         //字段值
         $item->showType = !$item->showType && $item->values ? 'radio' : $item->showType;
         $item->showType = !$item->showType ? 'text' : $item->showType;
         return $item;
     });
     return $data;
 }
예제 #18
0
 function mesajOku($oku)
 {
     $mesajOku = DB::select("select k.adi,k.soyadi,m.mesaj,m.tarih from mesajlar as m left join kullanicilar as k on m.gonderen_id=k.id where m.id = ? limit 0,1", array($oku));
     $d = DB::update('update mesajlar set durum=1 where id = ?', array($oku));
     $kullanici["user"] = $mesajOku[0];
     return view('admin/mesajOku', array('kullanici' => $kullanici));
 }
예제 #19
0
 public function moviesdiffu()
 {
     $query = DB::select('SELECT COUNT(distinct(movies_id)) as plop FROM sessions');
     $query2 = DB::table('movies')->count();
     $result = round($query[0]->plop * 100 / $query2);
     return $result;
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     DB::select('ALTER TABLE 013_355_article CHANGE title_355 title_355 VARCHAR(510) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL');
     DB::select('ALTER TABLE 013_355_article CHANGE date_355 date_355 INT(10) UNSIGNED NULL');
     DB::select('ALTER TABLE 013_355_article CHANGE sorting_355 sorting_355 INT(10) UNSIGNED NULL');
     DB::select('ALTER TABLE 013_355_article CHANGE sorting_355 sorting_355 INT(10) UNSIGNED NULL');
 }
 public function index()
 {
     $user_id = $this->user->id;
     $ownership = Projects::where('project_owner', $user_id)->where('status', '1')->get()->toArray();
     $membership = DB::select("SELECT * FROM projects WHERE find_in_set({$user_id}, project_members) <> 0 AND status = 1");
     return view('dashboard.index', compact('ownership', 'membership'));
 }
 public function importdata(Request $request)
 {
     $results = null;
     //        $results = $reader->get();
     //
     //        $ret = $results->toArray();
     $file = $request->file('exelimport');
     $request->file('exelimport')->move(storage_path() . '/public/import/', 'import.xlsx');
     //$request->file('exelimport')
     //        $results =    Excel::load($request->file('exelimport'))->toArray();
     $ret = Excel::filter('chunk')->load(storage_path('/public/import/import.xlsx'))->chunk(250, function ($results) {
         $data = array();
         foreach ($results as $index => $value) {
             //
             $im_date_start = $value["change_saving_rate_date"];
             $ret_data_start = str_replace("'", "", $im_date_start);
             $im_date_modify = $value["effective_date"];
             $ret_data_modify = str_replace("'", "", $im_date_modify);
             //                var_dump($ret_data_start);
             $date_start = new Date($ret_data_start);
             $date_modify = new Date($ret_data_modify);
             $EMP_ID = $value["emp_id"];
             //             $PERIOD = $value["period"];
             $allquery = "SELECT COUNT(EMP_ID) AS total FROM TBL_USER_SAVING_RATE  WHERE EMP_ID= '" . $EMP_ID . "' AND CHANGE_SAVING_RATE_DATE='" . $date_start . "'";
             $all = DB::select(DB::raw($allquery));
             $total = $all[0]->total;
             if ($total == 0) {
                 array_push($data, array('EMP_ID' => $value["emp_id"], 'USER_SAVING_RATE' => $value["user_saving_rate"], 'CHANGE_SAVING_RATE_DATE' => $date_start, 'EFFECTIVE_DATE' => $date_modify, 'MODIFY_COUNT' => $value["modify_count"], 'MODIFY_BY' => $value["modify_by"]));
             }
         }
         DB::table('TBL_USER_SAVING_RATE')->insert($data);
     });
     return response()->json(array('success' => true, 'html' => $ret));
 }
예제 #23
0
 public function getEditBancaEntitate($id, $id_entitate, $entitate)
 {
     $banca_class = new BancaController();
     $banci = $banca_class->getBanciOrganizatie();
     $banca = DB::select("SELECT\n            id,\n            id_banca,\n            iban,     \n            sucursala\n            FROM banca_entitate\n\t\t\tWHERE id = :id", array('id' => $id));
     return View::make("banca::banca_entitate.edit")->with("banca", $banca[0])->with("banci", $banci)->with("id_entitate", $id_entitate)->with("entitate", $entitate);
 }
예제 #24
0
 public function scopeQtdeArtigosPorMesAno()
 {
     $results = DB::select('select year(dt_criacao) as ano, month(dt_criacao) as mes, count(id_artigo) as qt_artigos
                                from tbl_artigos
                                group by year(dt_criacao), month(dt_criacao)');
     return $results;
 }
예제 #25
0
 public function Navsave(Request $request)
 {
     $ret = false;
     $rethtml = "";
     $data = array();
     $ID = $request->input('ID');
     $NAME = $request->input('NAME');
     $URL = $request->input('URL');
     $thumbnail = $request->file('client_upload');
     $fileThumb = "";
     $pathThunb = getenv('THUMB_PATH');
     $FILE_PATH = "http://measvp.mea.or.th:8081/contents/" . $fileThumb;
     $chk = "SELECT COUNT(ID) As total FROM TBL_EXT_LINK WHERE ID = " . $ID;
     $all = DB::select(DB::raw($chk));
     $total = $all[0]->total;
     if ($total > 0) {
         $rethtml = "รหัส ที่ท่านเลือกมีอยู่ในระบบแล้ว";
     } else {
         $data = array('ID' => $ID, 'NAME' => $NAME, 'FILE_PATH' => $FILE_PATH, 'URL' => $URL);
         if ($thumbnail != null) {
             $fileThumb = "client_" . $ID . ".png";
             $thumbnail->move(public_path() . $pathThunb, $fileThumb);
             //file_put_contents( 'C:\FileSharing\fund_file\contents', $fileThumb);
         }
         $ret = DB::table('TBL_EXT_LINK')->insert($data);
     }
     return redirect()->to('admin/con1')->with('message', 'ok');
     //
     //        return response()->json(array('success' => $ret, 'html'=>$rethtml));
 }
예제 #26
0
 /**
  *
  */
 public function index()
 {
     $results = DB::select('select * from admin where aid = :aid', ['aid' => 1]);
     //     	$admin = $results->fetch();
     //     	$admin = Admin::all();
     return view("admin/index/index");
 }
예제 #27
0
 /**
  * Returns the sum of all values a metric has by the hour.
  *
  * @param int $hour
  *
  * @return int
  */
 public function getValuesByHour($hour)
 {
     $dateTimeZone = SettingFacade::get('app_timezone');
     $dateTime = (new Date())->setTimezone($dateTimeZone)->sub(new DateInterval('PT' . $hour . 'H'));
     $hourInterval = $dateTime->format('YmdH');
     if (Config::get('database.default') === 'mysql') {
         if (!isset($this->calc_type) || $this->calc_type == self::CALC_SUM) {
             $value = (int) $this->points()->whereRaw('DATE_FORMAT(created_at, "%Y%m%d%H") = ' . $hourInterval)->groupBy(DB::raw('HOUR(created_at)'))->sum('value');
         } elseif ($this->calc_type == self::CALC_AVG) {
             $value = (int) $this->points()->whereRaw('DATE_FORMAT(created_at, "%Y%m%d%H") = ' . $hourInterval)->groupBy(DB::raw('HOUR(created_at)'))->avg('value');
         }
     } else {
         // Default metrics calculations.
         if (!isset($this->calc_type) || $this->calc_type == self::CALC_SUM) {
             $queryType = 'sum(metric_points.value)';
         } elseif ($this->calc_type == self::CALC_AVG) {
             $queryType = 'avg(metric_points.value)';
         } else {
             $queryType = 'sum(metric_points.value)';
         }
         $query = DB::select("select {$queryType} as aggregate FROM metrics JOIN metric_points ON metric_points.metric_id = metrics.id WHERE metric_points.metric_id = {$this->id} AND to_char(metric_points.created_at, 'YYYYMMDDHH24') = :timestamp GROUP BY to_char(metric_points.created_at, 'H')", ['timestamp' => $hourInterval]);
         if (isset($query[0])) {
             $value = $query[0]->aggregate;
         } else {
             $value = 0;
         }
     }
     if ($value === 0 && $this->default_value != $value) {
         return $this->default_value;
     }
     return $value;
 }
예제 #28
0
 function listele()
 {
     $data = DB::select('select y.id,k.adi,k.soyadi,u.baslik as urunBaslik,y.baslik as yorumBaslik,y.icerik,y.puan,y.tarih, y.durum as durum from yorumlar as y left join kullanicilar as k on y.kul_id = k.id left join urunler as u on y.urun_id = u.id order by y.id desc');
     $kullanici = DB::select('select * from kullanicilar order by id desc');
     $urunler = DB::select('select * from urunler order by id desc');
     return view('admin/urunYorumlar', array('data' => $data, 'kullanici' => $kullanici, 'urunler' => $urunler));
 }
 public function myposts()
 {
     $name = session('name');
     $avatar = session('avatar');
     $reviews = DB::select("\n            SELECT\n              review.rating,\n              review.summary,\n              school.abbreviation AS abbreviation,\n              course.courseCode AS ccode,\n              course.id AS cid,\n              school.id AS sid,\n              review.author,\n              review.datePosted\n            FROM\n              review\n            INNER JOIN course ON review.courseId = course.id\n            INNER JOIN school ON review.schoolId = school.id\n            WHERE review.author = '" . $name . "'\n            ORDER BY review.datePosted DESC;\n        ");
     return view('pages.profile', compact('reviews', 'name', 'avatar'));
 }
예제 #30
-1
 public function postSendsms(Request $request)
 {
     $mobile = Input::get('mobile');
     if (!preg_match("/1[3458]{1}\\d{9}\$/", $mobile)) {
         // if(!preg_match("/^13\d{9}$|^14\d{9}$|^15\d{9}$|^17\d{9}$|^18\d{9}$/",$mobile)){
         //手机号码格式不对
         return parent::returnJson(1, "手机号码格式不对" . $mobile);
     }
     $data = DB::select("select * from members where lifestatus=1 and mobile =" . $mobile);
     if (sizeof($data) > 0) {
         return parent::returnJson(1, "手机号已注册");
     }
     $checkCode = parent::get_code(6, 1);
     Session::put("m" . $mobile, $checkCode);
     $checkCode = Session::get("m" . $mobile);
     Log::error("sendsms:session:" . $checkCode);
     $msg = "尊敬的用户:" . $checkCode . "是您本次的短信验证码,5分钟内有效.";
     // Input::get('msg');
     $curl = new cURL();
     $serverUrl = "http://cf.lmobile.cn/submitdata/Service.asmx/g_Submit";
     $response = $curl->get($serverUrl . "?sname=dlrmcf58&spwd=ZRB2aP8K&scorpid=&sprdid=1012818&sdst=" . $mobile . "&smsg=" . rawurlencode($msg . "【投贷宝】"));
     $xml = simplexml_load_string($response);
     echo json_encode($xml);
     //$xml->State;
     //  <CSubmitState xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
     //   <State>0</State>
     //   <MsgID>1512191953407413801</MsgID>
     //   <MsgState>提交成功</MsgState>
     //   <Reserve>0</Reserve>
     // </CSubmitState>
     // <State>1023</State>
     //  <MsgID>0</MsgID>
     //  <MsgState>无效计费条数,号码不规则,过滤[1:186019249011,]</MsgState>
     //  <Reserve>0</Reserve>
 }