Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Cài đặt FreeTDS
- $ apt-get install libsybdb5 freetds-common php5-sybase
- * Thêm cấu hình trong config/database.php trong Laravel 5
- ```php
- 'sqlsrv' => [
- 'driver' => 'sqlsrv',
- 'host' => env('DB_HOST', 'localhost'),
- 'database' => env('DB_DATABASE', 'forge'),
- 'username' => env('DB_USERNAME', 'forge'),
- 'password' => env('DB_PASSWORD', ''),
- 'charset' => 'utf8',
- 'prefix' => '',
- ]
- ```
- * Sử dụng thêm DB::raw("N'Phạm Văn Trung'") vào trường tiếng viêt trong database
- ```php
- DB::table('users')->insert([
- 'name' => DB::raw("N'Phạm Văn Trung'"),
- 'username' => 'trungpv93',
- 'email' => 'email@gmail.com',
- 'password' => bcrypt('ABCXYZ'),
- ]);
- ```
- ```php
- $user = new User();
- $user->name = DB::raw("N'Phạm Văn Trung'");
- $user->username = 'trungpv93';
- $user->email = 'email@gmail.com';
- $user->password = bcrypt('ABCXYZ');
- $user->save();
- ```
- * Note (Option): Nếu có vấn đề về tiếng việt thì sửa lại tds version trong /etc/freetds/freetds.conf
- ```
- tds version = 8.0
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement