本文整理汇总了PHP中Illuminate\Support\Facades\DB::unprepared方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::unprepared方法的具体用法?PHP DB::unprepared怎么用?PHP DB::unprepared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\DB
的用法示例。
在下文中一共展示了DB::unprepared方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the users seeds.
*
* @return void
*/
public function run()
{
DB::table('organizations')->delete();
$statement = "ALTER TABLE organizations AUTO_INCREMENT = 1;";
DB::unprepared($statement);
Organization::create(['uuid' => uniqid(), 'name' => 'Gorilla LTD', 'address' => '61 cours du médoc', 'address_comp' => 'appt 22 bat B', 'user_id' => 1]);
}
示例2: run
/**
* Run the users seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->delete();
$statement = "ALTER TABLE users AUTO_INCREMENT = 1;";
DB::unprepared($statement);
User::create(['id' => 1, 'email' => 'alexandre.mangin@viacesi.fr', 'password' => bcrypt('123123'), 'organization_id' => 1]);
User::create(['id' => 2, 'email' => 'alan.corbel@viacesi.fr', 'password' => bcrypt('123123'), 'organization_id' => 1]);
User::create(['id' => 3, 'email' => 'clarquey@irisit.fr', 'password' => bcrypt('123123'), 'organization_id' => 1]);
}
示例3: run
/**
* Run the users seeds.
*
* @return void
*/
public function run()
{
DB::table('users_profiles')->delete();
$statement = "ALTER TABLE users_profiles AUTO_INCREMENT = 1;";
DB::unprepared($statement);
UserProfile::create(['firstname' => 'Alexandre', 'lastname' => 'Mangin', 'phone' => '0616391876', 'user_id' => 1]);
UserProfile::create(['firstname' => 'Alan', 'lastname' => 'Corbel', 'phone' => '0626381876', 'user_id' => 2]);
UserProfile::create(['firstname' => 'Christophe', 'lastname' => 'Larquey', 'phone' => '0605040302', 'user_id' => 3]);
}
示例4: run
public function run()
{
$faker = Faker::create();
//$table = 'lalalal';
//$this->command->getOutput()->writeln("<info>product table seeder table</info> $table");
DB::table('products')->delete();
DB::unprepared('alter table products auto_increment = 1');
for ($i = 1; $i <= env('MaxProductsSeeds'); $i++) {
Product::create(['name' => $faker->word, 'price' => $faker->randomFloat(), 'browsed' => $faker->boolean()]);
}
}
示例5: run
public function run()
{
$admin = array('displayName' => 'Andres Rangel', 'email' => 'arangeltorres@gmail.com', 'password' => bcrypt('12345'), 'active' => 1, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s"), 'image' => '55fa8e7a612e4.png');
$user = array('displayName' => 'User Andres', 'email' => 'a28rangel@gmail.com', 'password' => bcrypt('12345'), 'active' => 0, 'activation_code' => md5(microtime() . Config::get('app.key')), 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s"), 'image' => '55fa8e7a612e4.png');
$permissions = array(['display_name' => 'Manage Admin', 'name' => 'manage_admin', 'description' => 'Give permission to user to access the admin area.', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")], ['display_name' => 'Manage Own Data', 'name' => 'manage_own', 'description' => 'Allow users to manage their own data.', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
$roles = array(['display_name' => 'Admin', 'name' => 'admin', 'description' => 'Give user full permission to site functions.', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")], ['display_name' => 'User', 'name' => 'user', 'description' => 'Standard User', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
// Create Permissions
DB::table('permissions')->delete();
$statement = "ALTER TABLE permissions AUTO_INCREMENT = 1;";
DB::unprepared($statement);
DB::table('permissions')->insert($permissions);
// Create Roles
DB::table('roles')->delete();
$statement = "ALTER TABLE roles AUTO_INCREMENT = 1;";
DB::unprepared($statement);
DB::table('roles')->insert($roles);
// Clear relationships
DB::table('permission_role')->delete();
$statement = "ALTER TABLE permission_role AUTO_INCREMENT = 1;";
DB::unprepared($statement);
DB::table('role_user')->delete();
$statement = "ALTER TABLE role_user AUTO_INCREMENT = 1;";
DB::unprepared($statement);
// Create Users
DB::table('users')->delete();
$statement = "ALTER TABLE users AUTO_INCREMENT = 1;";
DB::unprepared($statement);
DB::table('users')->insert($admin);
DB::table('users')->insert($user);
// Attach permission to role
$role = $this->role->find(1);
$role2 = $this->role->find(2);
/*$perm_1 = $this->permission->find(1);
$role->attachPermission($perm_1);
$perm_2 = $this->permission->find(2);
$role2->attachPermission($perm_2);*/
// Attach role to user
$user = User::find(1);
$user->roles()->attach($role);
$user = User::find(2);
$user->roles()->attach($role2);
}
示例6: fire
public function fire()
{
// if ($this->confirm('Start install? [y|n]')) {
//create table with sql
if (!File::exists(app_path() . '/models/Tree.php')) {
$f = scandir(__DIR__ . '/../../../dump_sql_table/');
foreach ($f as $file) {
if (preg_match('/\\.(sql)/', $file)) {
$this->info("Processed file " . $file);
DB::unprepared(file_get_contents(__DIR__ . '/../../../dump_sql_table/' . $file));
}
}
}
//create folder 'public/css/builds'
if (!is_dir(public_path() . '/css/builds')) {
File::makeDirectory(public_path() . '/css/builds', 0777, true);
$this->info('Folder /css/builds is created');
}
//create folder 'public/js/builds'
if (!is_dir(public_path() . '/js/builds')) {
File::makeDirectory(public_path() . '/js/builds', 0777, true);
$this->info('Folder /js/builds is created');
}
//replace htaccess
// if(!File::exists(public_path() . '/.htaccess')) {
copy(__DIR__ . '/../../../misc/.htaccess', public_path() . '/.htaccess');
$this->info('Replace htaccess - OK');
//}
//replace HomeController
// if(!File::exists(app_path() . '/controllers/HomeController.php')) {
copy(__DIR__ . '/../../../misc/HomeController.php', app_path() . '/controllers/HomeController.php');
$this->info('Replace HomeController.php - OK');
// }
//replace router.php
//if(!File::exists(app_path() . '/routes.php')) {
copy(__DIR__ . '/../../../misc/routes.php', app_path() . '/routes.php');
$this->info('Replace routes.php - OK');
// }
//replace view_composers.php
if (!File::exists(app_path() . '/view_composers.php')) {
copy(__DIR__ . '/../../../misc/view_composers.php', app_path() . '/view_composers.php');
$this->info('Replace view_composers.php - OK');
}
//create folder mcamara/laravel-localization'
if (!is_dir(app_path() . '/config/packages/mcamara/laravel-localization')) {
File::makeDirectory(app_path() . '/config/packages/mcamara/laravel-localization', 0777, true);
$this->info('Folder /config/packages/mcamara/laravel-localization is created');
copy(__DIR__ . '/../../../misc/localization_config.php', app_path() . '/config/packages/mcamara/laravel-localization/config.php');
$this->info('Replace laravel-localization/config.php - OK');
}
if (!is_dir(app_path() . '/config/packages/intervention/imagecache')) {
File::makeDirectory(app_path() . '/config/packages/intervention/imagecache', 0777, true);
$this->info('Folder /config/packages/intervention/imagecache is created');
copy(__DIR__ . '/../../../misc/imagecache_config.php', app_path() . '/config/packages/intervention/imagecache/config.php');
$this->info('Replace imagecache/config.php - OK');
}
//replace BaseModel.php
if (!File::exists(app_path() . '/models/BaseModel.php')) {
copy(__DIR__ . '/../../../misc/BaseModel.php', app_path() . '/models/BaseModel.php');
$this->info('Replace BaseModel.php - OK');
}
//replace News.php
if (!File::exists(app_path() . '/models/News.php')) {
copy(__DIR__ . '/../../../misc/News.php', app_path() . '/models/News.php');
$this->info('Replace News.php - OK');
}
//replace Tree.php
if (!File::exists(app_path() . '/models/Tree.php')) {
copy(__DIR__ . '/../../../misc/Tree.php', app_path() . '/models/Tree.php');
$this->info('Replace Tree.php - OK');
}
//replace User.php
// if(!File::exists(app_path() . '/models/User.php')) {
copy(__DIR__ . '/../../../misc/User.php', app_path() . '/models/User.php');
$this->info('Replace User.php - OK');
// }
//replace Util.php
if (!File::exists(app_path() . '/models/Util.php')) {
copy(__DIR__ . '/../../../misc/Util.php', app_path() . '/models/Util.php');
$this->info('Replace Util.php - OK');
}
//replace Breadcrumbs.php
if (!File::exists(app_path() . '/models/Breadcrumbs.php')) {
copy(__DIR__ . '/../../../misc/Breadcrumbs.php', app_path() . '/models/Breadcrumbs.php');
$this->info('Replace Breadcrumbs.php - OK');
}
$this->call('asset:publish', array('package' => 'vis/builder'));
if (!File::exists(app_path() . '/config/packages/vis/builder/admin.php')) {
$this->call('config:publish', array('package' => 'vis/builder'));
}
if (!File::exists(app_path() . '/config/packages/cartalyst/sentry/config.php')) {
$this->call('config:publish', array('package' => 'cartalyst/sentry'));
}
$this->call('cache:clear');
$this->call('ide-helper:generate');
// }
return;
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = \Faker\Factory::create();
DB::table('countries')->delete();
DB::unprepared(file_get_contents('database/seeds/imports/countries.sql'));
}
示例8: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::unprepared('DROP TRIGGER IF EXISTS "before_session_delete" ON sessions;');
DB::unprepared('DROP FUNCTION before_session_delete();');
}
开发者ID:furious-programming,项目名称:coyote,代码行数:10,代码来源:2015_10_29_194849_create_after_session_delete_trigger.php