2017-02-10 2 views
0

Ich bin neu in Laravel und versuche durch die Entwicklung einer Website hineinzukommen. Ich habe meine Onw CMS für Corporate Websites und benutze es. Ich habe ein Modell erstellt, um Daten aus der Datenbank zu bekommen, die von ckeditor hinzugefügt wurden. Aber irgendwie bin ich mit türkischem Charakter konfrontiert. Wenn jemand mir helfen kann, wäre es für einen neuen Laravel Entwickler sehr gut sein :)Laravel 5 Turkish Character Issue

Meine Datenbank-Konfiguration:

'mysql' => [ 
     'driver' => 'mysql', 
     'host' => env('DB_HOST', '127.0.0.1'), 
     'port' => env('DB_PORT', '3306'), 
     'database' => env('DB_DATABASE', 'forge'), 
     'username' => env('DB_USERNAME', 'forge'), 
     'password' => env('DB_PASSWORD', ''), 
     'charset' => 'utf8', 
     'collation' => 'utf8_unicode_ci', 
     'prefix' => '', 
     'strict' => true, 
     'engine' => null, 
    ], 

Mein SingleContent Modell

namespace App\Model\Modules; 

use App\Model\Config\Language; 
use App\Model\Config\Menulist; 
use Illuminate\Database\Eloquent\Model; 

class SingleContent extends Model 
{ 

/** 
* The table associated with the model. 
* 
* @var string 
*/ 
public $table = "resimsiztekicerik"; 

/* 
* Set increment column name 
* 
* @var string 
*/ 
protected $primaryKey = "entryId"; 

/** 
* Indicates if the model should be timestamped. 
* 
* @var bool 
*/ 
public $timestamps = false; 

// MASS ASSIGNMENT ------------------------------------------------------- 
// define which attributes are mass assignable (for security) 
// we only want these 1 attributes able to be filled 
protected $fillable = array('entryTitle','entryContent'); 


/* 
* get content of given menu id 
* 
* @param int 
* 
* @return array (database record row) 
*/ 
public static function getContent($menuId) 
{ 

    return SingleContent::where('langId',1)->where('menuId',1)->first(); 
} 

} 

Mein AppController

namespace App\Http\Controllers; 

use Illuminate\Http\Request; 
use App; 
use App\Model\Config\Language; 
use App\Model\Config\Menulist; 
use App\Model\Modules\SingleContent; 

class AppController extends Controller 
{ 

public function index() 
{ 

    // about me content 
    $about_me = SingleContent::getContent(1); 

    // view datas 
    $view_data = array(); 
    $view_data['about_me'] = $about_me; 

    return view('app',$view_data); 
} 

} 

Meine App.blade

... 
<meta charset="utf-8"> 
... 
<div class="block"> 

    <div class="block-title"> 
    {{ $about_me->entryTitle }} 
    </div> 
    <div class="block-content"> 
    {!! $about_me->entryContent !!} 
    </div> 

</div> 
... 

Ergebnis für {{$ about_me-> entryTitle}}:

Hakkımda 

Ergebnis für {!! about_me- $> entryContent !!}:

Web ProgramcılıÄı ile lisede tanıÅtım ve yapmam gereken mesleÄin bu olduÄuna inanarak 1 yıllık stajımı tamamladıktan sonra 6 yıldır web geliÅtirme alanında profesyonel olarka hizmet veriyorum. Kurumsal websitesi, e-ticaret websitesi, otomasyon, vb. alanlarında çalıÅmalarım oldu. 

EDIT:

By the way, diese ow meine Platte wie in phpMyAdmin sieht und ich in Spalten bin mit utf8_geneal_ci, Tabellen und auch die Datenbankeinstellungen , es sieht gut in meinem cms und codeigniter aus, aber ich bin nicht sicher, ob es richtig ist. Ich habe wenig Erfahrung mit der Kodierung.

enter image description here

Antwort

0

ich es durch die Umwandlung Datenbank, Tabellen und Spalten Sortierungs

von

utf8_general_ci

gelöst hinzufügen

zu

utf8mb4_unicode_ci

0

Try Blade::setEchoFormat('e(utf8_encode(%s))'); in der Boot-Methode Ihrer AppServiceProvider

+0

Vielen Dank für Antwort, aber leider hat es nicht beeinflussen. –