コード例 #1
0
 public static function setUpBeforeClass()
 {
     if (!isset(self::$app)) {
         self::$app = AppFactory::create();
     }
     if (!Schema::hasTable('users')) {
         Schema::create('users', function ($table) {
             $table->increments('id');
             $table->string('name');
         });
     }
     DB::insert('insert into users (name) values (?)', array('Test User'));
     if (!Schema::hasTable('posts')) {
         Schema::create('posts', function ($table) {
             $table->increments('id');
             $table->string('title');
             $table->integer('created_by')->unsigned()->nullable();
             $table->integer('updated_by')->unsigned()->nullable();
             $table->integer('deleted_by')->unsigned()->nullable();
             $table->timestamps();
             $table->timestamp('deleted_at')->nullable();
             $table->foreign('created_by')->references('id')->on('users');
             $table->foreign('updated_by')->references('id')->on('users');
             $table->foreign('deleted_by')->references('id')->on('users');
         });
     }
 }
コード例 #2
0
 public function run()
 {
     DB::insert('insert into produtos (nome, quantidade, valor, descricao, created_at, updated_at) values (?,?,?,?,?,?)', array('Geladeira', 2, 590.0, 'Side by side com gelo na porta', '2015-07-01', '2015-07-01'));
     DB::insert('insert into produtos (nome, quantidade, valor, descricao, created_at, updated_at) values (?,?,?,?,?,?)', array('Fogão', 5, 950.0, 'Painel Automatico e forno eletrico', '2015-07-01', '2015-07-01'));
     DB::insert('insert into produtos (nome, quantidade, valor, descricao, created_at, updated_at) values (?,?,?,?,?,?)', array('Microondas', 1, 250.0, 'Manda sms quando termina de esquentar', '2015-07-01', '2015-07-01'));
     DB::insert('insert into produtos (nome, quantidade, valor, descricao, created_at, updated_at) values (?,?,?,?,?,?)', array('Cama Box Casal', 3, 340.0, 'Excelente Cama', '2015-07-01', '2015-07-01'));
 }
コード例 #3
0
 public function duzenleForm($id)
 {
     $data = Input::all();
     $kural = array('baslik' => 'required|min:3', 'resim' => 'max:1536|required|mimes:jpeg,jpg,bmp,png,gif');
     $dogrulama = \Validator::Make($data, $kural);
     if (!$dogrulama->passes()) {
         return \Redirect::to('admin/galeriler/duzenle/' . $id)->withErrors($dogrulama)->withInput();
     } else {
         if (Input::hasFile('resim')) {
             $dosya = Input::file('resim');
             $uzanti = $dosya->getClientOriginalExtension();
             if (strlen($uzanti) == 3) {
                 $dosyaAdi = substr($dosya->getClientOriginalName(), 0, -4);
             } else {
                 if (strlen($uzanti) == 4) {
                     $dosyaAdi = substr($dosya->getClientOriginalName(), 0, -5);
                 }
             }
             $dosyaAdi = $dosyaAdi . "_" . date('YmdHis') . '.' . $uzanti;
             $path = base_path('galeriResimler/600x450/' . $dosyaAdi);
             Image::make($dosya->getRealPath())->resize(600, 450)->save($path);
             $path = base_path('galeriResimler/defaultSize/' . $dosyaAdi);
             Image::make($dosya->getRealPath())->save($path);
             $path = $dosyaAdi;
             $query = DB::insert('insert into gal_resim values (null,?,?,?)', array($id, $data["baslik"], $path));
             return Redirect::back();
         }
     }
 }
コード例 #4
0
 public function importdata(Request $request)
 {
     $results = null;
     $type = $request->input('type');
     $retdate = Excel::load($request->file('exelimport'), function ($reader) use($type) {
         $results = $reader->get();
         $ret = $results->toArray();
         //            var_dump($ret);
         foreach ($ret as $index => $value) {
             $EMP_ID = $value["emp_id"];
             $PLAN_ID = $value["plan_id"];
             $EQUITY_RATE = $value["equity_rate"];
             $DEBT_RATE = $value["debt_rate"];
             $MODIFY_DATE = $value["modify_date"];
             $EFFECTIVE_DATE = $value["effective_date"];
             $MODIFY_COUNT = $value["modify_count"];
             $MODIFY_COUNT_TIMESTAMP = $value["modify_count_timestamp"];
             $MODIFY_BY = $value["modify_by"];
             $insert = "INSERT INTO TBL_USER_FUND_CHOOSE (PLAN_ID,EMP_ID,EQUITY_RATE,DEBT_RATE,MODIFY_DATE,EFFECTIVE_DATE,MODIFY_COUNT,MODIFY_COUNT_TIMESTAMP,MODIFY_BY) VALUES(" . $PLAN_ID . ",'" . $EMP_ID . "'," . $EQUITY_RATE . "," . $DEBT_RATE . ",'" . $MODIFY_DATE . "','" . $EFFECTIVE_DATE . "'," . $MODIFY_COUNT . ",'" . $MODIFY_COUNT_TIMESTAMP . "','" . $MODIFY_BY . "')";
             DB::insert(DB::raw($insert));
         }
         $staturet = true;
         $data = "ok";
     });
     return response()->json(array('success' => true, 'html' => $retdate));
 }
コード例 #5
0
ファイル: TestController.php プロジェクト: jew977/laravel5.1
 public function testTransaction()
 {
     DB::beginTransaction();
     DB::insert('insert into users (name,email,password) values (?,?,?)', ['ceshi', '*****@*****.**', 'ddddd']);
     //        DB::rollback();
     DB::commit();
 }
コード例 #6
0
 public function ekle()
 {
     $yukseklik = $_POST["yukseklik"];
     $genislik = $_POST["genislik"];
     //        $data = Input::all();
     //        //$id = $data["id"];
     //        // Validasyonlar
     //        $kural = array(
     //            'ad'=>'required',
     //            'yol'=>'required',
     //            'genislik'=>'required',
     //            'yukseklik'=>'required',
     //            'url'=>'required',
     //            'durum'=>'required');
     //        $dogrulama = \Validator::Make($data,$kural);
     //        if($dogrulama->fails()){
     //            // gönderilen verilerde hata var
     //            return \Redirect::to('admin/bannerEkle')->withErrors($dogrulama)->withInput();
     //        } else {
     if (isset($_POST["ekle"])) {
         $dosya = Input::file('dosya');
         $data = Input::all();
         $uzanti = $dosya->getClientOriginalExtension();
         $dosyaAdi = date('YmdHis') . "_b." . $uzanti;
         $path = base_path('bannerResimler/' . $dosyaAdi);
         $imagePath = 'bannerResimler/' . $dosyaAdi;
         Image::make($dosya->getRealPath())->resize($genislik, $yukseklik)->save($path);
         DB::insert("insert into banner values (null, ?,?,?,?,?,?,?,?,?,?,?)", array($data["adi"], '0', $data["yukseklik"], $data["genislik"], $dosyaAdi, $data["link"], '0', '0', $data["baslangic"], $data["bitis"], $data["durum"]));
         return Redirect('admin/bannerListele');
     }
 }
コード例 #7
0
 public function setData()
 {
     $humidity = Request::input("h");
     $temperature = Request::input("t");
     $slaveName = Request::input("s");
     $addedOn = date("Y-m-d H:i:s");
     $methane = Request::input("m");
     $carbonMon = Request::input("cm");
     try {
         DB::insert("insert into humidities (slave_name, humidity, added_on) values (?,?,?)", [$slaveName, $humidity, $addedOn]);
         DB::insert("insert into temperatures (slave_name, temperature, added_on) values (?,?,?)", [$slaveName, $temperature, $addedOn]);
         if (isset($methane)) {
             DB::insert("insert into methane (methane_value, added_on) values (?,?)", [$methane, $addedOn]);
         }
         if (isset($carbonMon)) {
             DB::insert("insert into carbon_monoxide (carbon_value, added_on) values (?,?)", [$carbonMon, $addedOn]);
         }
         $data = array("status" => "success");
         header("Access-Control-Allow-Origin: *");
         return json_encode($data);
     } catch (QueryException $e) {
         $data = array("status" => $e->getMessage());
         header("Access-Control-Allow-Origin: *");
         return json_encode($data);
     }
 }
コード例 #8
0
ファイル: DatabaseSeeder.php プロジェクト: jpedro88/estoque
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //class ProdutoTableSeeder extends Seeder {
     DB::insert('insert into produtos (nome, quantidade, valor, descricao) values (?,?,?,?)', array('Geladeira', 2, 5900.0, 'Side by Side com gelo na porta'));
     DB::insert('insert into produtos (nome, quantidade, valor, descricao) values (?,?,?,?)', array('Fogão', 5, 950.0, 'Painel automático e forno elétrico'));
     DB::insert('insert into produtos (nome, quantidade, valor, descricao) values (?,?,?,?)', array('Microondas', 1, 1520.0, 'Manda SMS quando termina de esquentar'));
 }
コード例 #9
0
ファイル: Status.php プロジェクト: maxiv/router-pulse
 public function recreate()
 {
     $last = DB::select("SELECT * FROM statuses ORDER BY session_ended DESC LIMIT 1");
     if (sizeof($last)) {
         $session = $last[0];
         DB::insert("INSERT INTO statuses (ip, isp1, isp2, session_started, session_ended) VALUES ('" . $session->ip . "', '" . $session->isp1 . "', '" . $session->isp2 . "', NOW(), NOW())");
     }
 }
コード例 #10
0
ファイル: FillDatabase.php プロジェクト: littleguy230/bold
 public function insertSections()
 {
     $insertString = 'insert into sections (slug, shortname, name) values (?, ?, ?)';
     $defaultSections = [['news', 'News', 'News'], ['opinion', 'Opinion', 'Opinion'], ['features', 'Features', 'Features'], ['arts-entertainment', 'Arts & Entertainment', 'A&E'], ['sports', 'Sports', 'Sports']];
     foreach ($defaultSections as $sectionArray) {
         DB::insert($insertString, $sectionArray);
     }
 }
コード例 #11
0
ファイル: BOLDImport.php プロジェクト: nsandlin/linepig
 /**
  * Insert all Genus/Species into the BOLD table.
  *
  * @param array $genusSpeciesList
  *   An array of the Genus/Species list.
  *
  * @return void
  */
 public function insertRecords($genusSpeciesList)
 {
     foreach ($genusSpeciesList as $gs) {
         DB::insert('INSERT INTO bold (genus_species) VALUES (?)', [$gs]);
     }
     Log::info("Done adding records to the BOLD table.");
     print "Done adding records to the BOLD table." . PHP_EOL;
 }
コード例 #12
0
ファイル: MysqlStorage.php プロジェクト: brnbp/warehouse
 /**
  * INSERT query
  * @param  array  $content array onde keys são os campos da tabela
  *  e values as informações que serão inseridas
  */
 public function insert(array $content)
 {
     $this->validateTable();
     $keys = $this->getKeysSQLFormated($content);
     $values = $this->getValuesSQLFormated($content);
     $query = 'INSERT INTO ' . $this->table_name . '(' . $keys . ') VALUES(' . $values . ')';
     return DB::insert($query);
 }
コード例 #13
0
 public function ekle()
 {
     $data = Input::all();
     var_dump($data);
     $ekle = DB::insert("insert into kullanicilar(id,adi,soyadi,mail,sifre,tarih) values(null,?,?,?,?,now())", array($data["adi"], $data["soyadi"], $data["mail"], $data["sifre"]));
     //return view('liste');
     return Redirect::to('veritabani');
     // Bu da bir yönlendirme işlemidir . to sayesinde .
 }
コード例 #14
0
 public function run()
 {
     DB::insert('insert into produtos(nome, quantidade, valor, descricao)
     values(?, ?, ?, ?)', array('Geladeira', 2, 5900.0, 'Side by Side com gelo na porta'));
     DB::insert('insert into produtos(nome, quantidade, valor, descricao)
     values(?, ?, ?, ?)', array('Fogao', 5, 950.0, 'Painel automatico e forno eletrico'));
     DB::insert('insert into produtos(nome, quantidade, valor, descricao)
     values(?, ?, ?, ?)', array('Microondas', 1, 1520.0, 'Manda sms quando termina de esquentar'));
 }
コード例 #15
0
ファイル: Game.php プロジェクト: grit45/EEISTI-Tournaments
 static function create($game)
 {
     DB::insert('INSERT INTO Games(name, num_players, nickname_field, multicampus) VALUES (:name, :num_players, :nickname_field, :multicampus)', $game);
     $id = DB::getPdo()->lastInsertId();
     //		if (!empty($game->extra_fields)) {
     //			this.insertFields($id, $game->extra_fields);
     //		}
     return $id;
 }
コード例 #16
0
ファイル: Entry.php プロジェクト: grit45/EEISTI-Tournaments
 static function create($entry)
 {
     DB::insert('INSERT INTO Entries(name, real_name, email, id_game, campus, time, id_team, password, is_approved) VALUES (:name, :real_name, :email, :id_game, :campus, :time, :id_team, :password, :is_approved)', $entry);
     $id = DB::getPdo()->lastInsertId();
     //		if (!empty($entry->extra_fields)) {
     //			this.insertFieldEntries($id, $entry->extra_entries);
     //		}
     return $id;
 }
コード例 #17
0
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        DB::insert('insert into produtos (nome, quantidade, valor, descricao)
			values(?, ?, ?, ?)', array('Geladeira', 2, 900.0, 'Side by Side com gelo na porta'));
        DB::insert('insert into produtos (nome, quantidade, valor, descricao)
			values(?, ?, ?, ?)', array('Fogão', 5, 950.0, 'Painel automático e forno elétrico'));
        DB::insert('insert into produtos (nome, quantidade, valor, descricao)
			values(?, ?, ?, ?)', array('Microondas', 1, 520.0, 'Manda SMS quando termina de esquentar'));
    }
コード例 #18
0
ファイル: Text.php プロジェクト: Rep2/NMBP-1.-projekt
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['text' => 'required']);
     if ($validator->fails()) {
         return response()->json(['error' => $validator->errors()->all()], 400);
     }
     $text = $request->input('text');
     DB::insert("INSERT INTO texts VALUES (nextval('textsSequence'), '" . $text . "', to_tsvector('" . $text . "'))");
     return response()->json(['message' => 'Redak dodan'], 200);
 }
コード例 #19
0
 public function adiciona(Request $request)
 {
     $nome = $request->input('nome');
     $valor = $request->input('valor');
     $descricao = $request->input('descricao');
     $quantidade = $request->input('quantidade');
     DB::insert('insert into produtos (nome, valor, descricao, quantidade) 
 values (?, ?, ?, ?)', array($nome, $valor, $descricao, $quantidade));
     return view('produto.adicionado')->with('nome', $nome);
 }
コード例 #20
0
 public function ekle()
 {
     $data = Input::all();
     $dataEkle = DB::insert("insert into linkler values(null,?,?)", array($data["siteadi"], $data["siteadresi"]));
     if ($dataEkle) {
         return Redirect::to('admin/linkler');
     } else {
         echo "hata  ";
     }
 }
コード例 #21
0
 static function InsertProduct($mainName, $mainID, $subName, $subID)
 {
     $productName = $mainName . " -> " . $subName . str_random(6);
     $productDesc = "bla bla bla";
     $productImage = "images/testProduct3.jpg";
     $productPrice = "12.99";
     $productModels = 0;
     $insert = DB::insert("INSERT INTO products (product_name, product_image, product_description, product_price, product_main_category, product_sub_category, has_models) VALUES(?,?,?,?,?,?,?)", [$productName, $productImage, $productDesc, $productPrice, $mainID, $subID, 0]);
     echo "inserted <br/>";
 }
コード例 #22
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $pass = bcrypt($request->password);
     $user = new User();
     $user->name = $request->nom_prenom;
     $user->email = $request->email;
     $user->password = $pass;
     $user->save();
     DB::insert('insert into role_user (user_id,role_id) values (?,?)', [$user->id, $request->role]);
     return redirect()->back();
 }
コード例 #23
0
ファイル: SphinxController.php プロジェクト: AaronBin/laraver
 public function data()
 {
     $data = array(0 => array('test three', 'this is my test document number three. also checking search within phrases.'), 1 => array('test five', 'this is my test document number five. also checking search within phrases.'), 2 => array('test five', 'this is my test document number five. also checking search within phrases.'), 3 => array('test six', 'this is my test document number six. also checking search within phrases.'), 4 => array('test seven', 'this is my test document number seven. also checking search within phrases.'), 5 => array('test seven', 'this is my test document number seven. also checking search within phrases.'), 6 => array('test eight', 'this is my test document number eight. also checking search within phrases.'), 7 => array('test nine', 'this is my test document number nine. also checking search within phrases.'), 8 => array('About Laravel', 'The Laravel framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine'), 9 => array('Sphinx overview', 'Sphinx is an open source full text search server, designed from the ground up with performance, relevance (aka search quality),'), 10 => array('Sphinx License', 'The Sphinx Search server is dual-licensed, thus it can be either commercially licensed or freely available via the Downloads page if used in accordance with the terms of the GPL v.2'), 11 => array('hello world', 'hello World hello World hello World'), 14 => array('hello', 'hello World hello World'), 12 => array('hello', 'hello World'), 13 => array('永利宝', '永利宝是一家金融网站'));
     for ($x = 0; $x < 1000000; $x++) {
         $key = rand(0, 14);
         $title = $data[$key][0];
         $content = $data[$key][1];
         $sql = "INSERT INTO documents(group_id,group_id2,date_added,title,content) VALUES(3,6,NOW(),'{$title}','{$content}');";
         DB::insert($sql);
     }
 }
コード例 #24
0
 function gonderForm()
 {
     $data = Input::all();
     $kural = array('kisiler' => 'required', 'mesaj' => 'required');
     $dogrulama = \Validator::Make($data, $kural);
     $kulID = Session::get('id');
     if (!$dogrulama->passes()) {
         return \Redirect::to('admin/mesajlar/gonder')->withErrors($dogrulama)->withInput();
     } else {
         $query = DB::insert("insert into mesajlar VALUES(null,?,?,?,DEFAULT,now())", array($kulID, $data["kisiler"], $data["mesaj"]));
         return Redirect::to('admin/mesajlar');
     }
 }
コード例 #25
0
 public function ekle()
 {
     $data = Input::all();
     $kural = array('baslik' => 'required', 'kisa_aciklama' => 'required', 'detay' => 'required');
     $dogrulama = \Validator::Make($data, $kural);
     if ($dogrulama->fails()) {
         // gönderilen verilerde hata var
         return \Redirect::to('admin/icerikEkle')->withErrors($dogrulama)->withInput();
     }
     //var_dump($data);
     $veri = DB::insert("insert into icerikler values(null,?,?,?,now())", array($data["baslik"], $data["kisa_aciklama"], $data["detay"]));
     return \Redirect::to('admin/icerikEkle');
 }
コード例 #26
0
 public function ekle()
 {
     $data = Input::all();
     $kural = array('kategoriAdi' => 'required|min:3');
     $dogrulama = \Validator::Make($data, $kural);
     if (!$dogrulama->passes()) {
         return \Redirect::to('admin/galerikategori')->withErrors($dogrulama)->withInput();
     } else {
         $query = DB::insert("insert into gal_kategori values (null,?)", array($data["kategoriAdi"]));
     }
     $data = DB::select('select * from gal_kategori order by id desc');
     return \Redirect::to('admin/galerikategori')->with(array('data' => $data));
 }
コード例 #27
0
ファイル: Roster.php プロジェクト: svetlinyotov/Timeline_v2.0
 public static function add(array $data) : bool
 {
     $pdo = DB::connection()->getPdo();
     $roster_insert = DB::insert("INSERT INTO rosters (company_id, name, start_time, end_time, other, address, coordinates, added_by, updated_at, created_at) VALUES (?,?,?,?,?,?,?,?,?,?)", [$data['company_id'], $data['name'], $data['start_time'], $data['end_time'], $data['other'], $data['address'], $data['coordinates'], $data['added_by'], new \DateTime(), new \DateTime()]);
     if ($roster_insert) {
         $id = $pdo->lastInsertId();
         $roster_user_insert = DB::insert("INSERT INTO roster_user (user_id, is_supervisor, roster_id) VALUES (?,?,?)", [$data['id'], $data['is_supervisor'], $id]);
         if ($roster_user_insert) {
             return true;
         }
     }
     return false;
 }
コード例 #28
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::insert('insert into produtos
         (nome, quantidade, valor, descricao)
         values (?,?,?,?)', array('Geladeira', 2, 5900.0, 'Side by Side com gelo na porta'));
     DB::insert('insert into produtos
         (nome, quantidade, valor, descricao)
         values (?,?,?,?)', array('Fog�o', 2, 5900.0, 'Side by Side com gelo na porta'));
     DB::insert('insert into produtos
         (nome, quantidade, valor, descricao)
         values (?,?,?,?)', array('Microondas', 2, 5900.0, 'Side  Side com gelo na porta'));
     DB::insert('insert into produtos
         (nome, quantidade, valor, descricao)
         values (?,?,?,?)', array('Mesa', 1, 1.0, 'Mesa de oito cadeiras'));
 }
コード例 #29
0
 public function ekle()
 {
     $durum = Input::all();
     $kural = array('kategori_adi' => 'required|max:60');
     $dogrulama = \Validator::Make($durum, $kural);
     if ($dogrulama->fails()) {
         // gönderilen verilerde hata var
         return \Redirect::to('admin/kategori')->withErrors($dogrulama)->withInput();
     } else {
         $giden = DB::insert("insert into kategoriler  VALUES (NULL ,?,?)", array($durum["topCategory"], $durum["kategori_adi"]));
         if (isset($giden)) {
             return Redirect::to('admin/kategori');
         }
     }
 }
コード例 #30
0
 public function adiciona()
 {
     //pega as infos do formulario
     $nome = Request::input('nome');
     $valor = Request::input('valor');
     $quantidade = Request::input('quantidade');
     $descricao = Request::input('descricao');
     //salva no banco
     DB::insert('insert into produtos (nome,quantidade,valor,descricao) values (?,?,?,?)', array($nome, $quantidade, $valor, $descricao));
     //mostra mensagem de sucesso
     //return view('produto/adicionado')->with('nome',$nome);
     //redireciona para a listagem ao invés de printar a mensagem de sucesso.
     //O withInput salva as variaveis da requisição passada, passando-as para a nova página
     return redirect()->action('ProdutoController@lista')->withInput(Request::only('nome'));
 }