fix: Enable tag slug creation from CN characters (#1077)
This commit is contained in:
parent
0d9850c1c7
commit
9e6321e500
2 changed files with 20 additions and 4 deletions
|
@ -4,13 +4,11 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Item;
|
||||
use App\User;
|
||||
use DB;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
|
@ -68,7 +66,7 @@ class TagController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
$slug = str_slug($request->title, '-');
|
||||
$slug = str_slug($request->title, '-', 'en_US');
|
||||
|
||||
$current_user = User::currentUser();
|
||||
|
||||
|
@ -140,7 +138,7 @@ class TagController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
$slug = str_slug($request->title, '-');
|
||||
$slug = str_slug($request->title, '-', 'en_US');
|
||||
// set item type to tag
|
||||
$request->merge([
|
||||
'url' => $slug,
|
||||
|
|
18
tests/Unit/helpers/SlugTest.php
Normal file
18
tests/Unit/helpers/SlugTest.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit\helpers;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class SlugTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US()
|
||||
{
|
||||
$tag = str_slug('中文測試', '-', 'en_US');
|
||||
|
||||
$this->assertEquals('zhong-wen-ce-shi', $tag);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue