お世話になります。
試行錯誤をして、TinyMCE の実装はうまく出来たのですが
TinyMCEで内容を登録して保存して表示すると
HTMLタグがそのまま表示されてしまいます。
これをHTMLとして認識させるにはどこを変更すればいいのでしょうか???
保存の時?表示する時?まったく見当が着いていません
ヒントか何かありましたらご教示お願い致します。
show.blade.php
php
1@extends('layouts.layout') 2@section('title') 3詳細 4@endsection 5 6@section('content') 7<section class="center-block show"> 8 <h1 class="headding07">@yield('title')</h1> 9 <div class="well text-justify"> 10 <h2 class="headding06">{{$faq->title}}</h2> 11 <div class="information"><span class="bg-primary">投稿者 : {{$faq->user_name}} </span><span class="bg-success">所属部署 : {{$faq->section}}</span></div> 12<hr> 13 <div>{{$faq->body}}</div> 14 </div> 15 <table class="table-bordered tags"> 16 <tr> 17 <th>タグ</th> 18 <td>{{$faq->tag}}</td> 19 </tr> 20 </table> 21</section> 22@endsection 23
FaqsController.php
php
1<?php 2 3namespace App\Http\Controllers; 4 5use Illuminate\Http\Request; 6use App\Faq; 7 8class FaqsController extends Controller 9{ 10 //homeTEST 11 public function home(){ 12 return view('home'); 13 } 14 //新規登録 15 public function new(){ 16 return view('faqs.new'); 17 } 18 //新規登録メソッド 19 public function create(Request $request) { 20 //入力ルール(バリデート)作成予定 21 22 $Faq = new Faq(); 23 $Faq -> user_name = $request -> user_name; 24 $Faq -> title = $request -> title; 25 $Faq -> tag = $request -> tag; 26 $Faq -> section = $request -> section; 27 $Faq -> body = $request-> body; 28 //$Faq -> value = $request-> value; 29 $Faq -> save(); 30 return redirect('/'); 31 } 32 //編集 33 public function edit(Faq $Faq){ 34 return view('faqs.edit')->with('Faq',$Faq); 35 } 36 //編集登録メソッド 37 public function update(Request $request, Faq $Faq) { 38 //入力ルール(バリデート)作成予定 39 $Faq -> user_name = $request -> user_name; 40 $Faq -> title = $request -> title; 41 $Faq -> tag = $request -> tag; 42 $Faq -> section = $request -> section; 43 $Faq -> body = $request-> body; 44 $Faq -> value = $request-> value; 45 $Faq -> save(); 46 return redirect('/'); 47 } 48 49 //詳細 50 public function show(Faq $faq){ 51 //dd($faq->toArray()); // dump die 52 return view('faqs.show')->with('faq',$faq); 53 } 54 //削除 55 public function delete(Faq $faq){ 56 $faq->delete(); 57 return redirect('/'); 58 } 59//一覧表示 60public function list(){ 61 // $posts = \App\Post::all(); 62 // $posts = Post::all(); 63 // $posts = Post::orderBy('created_at', 'desc')->get(); 64 $faqs = Faq::latest()->get(); 65 // $posts = []; 66 //dd($faqs->toArray()); // dump die 67 // return view('posts.index', ['posts' => $posts]); 68 return view('faqs.list')->with('faqs', $faqs); 69} 70 //検索 71 public function search(Request $request) 72 { 73 #キーワード受け取り 74 $keyword = $request->input('keyword'); 75 76 #クエリ生成 77 $query = Faq::query(); 78 79 #もしキーワードがあったら 80 if(!empty($keyword)) 81 { 82 $query->where('tag','like','%'.$keyword.'%') 83 ->orWhere('body','like','%'.$keyword.'%') 84 ->orWhere('tel','like','%'.$keyword.'%'); 85 } 86 $Faqs = $query->orderBy('created_at','desc')->paginate(10); 87 return view('Faq.index')->with(compact("Faqs","keyword")); 88 return view('Faq.index')->with('Faqs',$Faqs); 89 90 } 91}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/06 10:52