I am using Laravel 5.2 and using UniSharp/laravel-ckeditor package to implement ckeditor in my project.Everything seems to work fine.But when I send data of ckeditor input field,it's not inserting in database.The data of other input field working fine.When i use normal text-area instead of ckeditor it's also working fine.
The Form In my view:
{{Form::open(array('url'=>'gettopics'))}}
<input type="text" name="title" class="form-control"/>
**<input type="textarea" name="detail" id="article-ckeditor">**
{{Form::close()}}
<script>
CKEDITOR.replace( 'article-ckeditor' );
</script>
The Route:
Route::post('gettopics','TopicsController@gettopics');
The Controller:
public function gettopics(Request $request){
$topic=new Topic;
$topic->title=$request->Input('title');
$topic->detail=$request->Input('detail');
$topic->save();
}
I am using Laravel 5.2 and using UniSharp/laravel-ckeditor package to implement ckeditor in my project.Everything seems to work fine.But when I send data of ckeditor input field,it's not inserting in database.The data of other input field working fine.When i use normal text-area instead of ckeditor it's also working fine.
The Form In my view:
{{Form::open(array('url'=>'gettopics'))}}
<input type="text" name="title" class="form-control"/>
**<input type="textarea" name="detail" id="article-ckeditor">**
{{Form::close()}}
<script>
CKEDITOR.replace( 'article-ckeditor' );
</script>
The Route:
Route::post('gettopics','TopicsController@gettopics');
The Controller:
public function gettopics(Request $request){
$topic=new Topic;
$topic->title=$request->Input('title');
$topic->detail=$request->Input('detail');
$topic->save();
}
Share
Improve this question
asked Aug 20, 2016 at 10:32
Asm ArmanAsm Arman
3798 silver badges24 bronze badges
2 Answers
Reset to default 3To render the html content, do this
{{!! $topic->detail !!}}
Note that if spaced wrongly, it will not work. So, make sure there is no space before the first '!!' and no space after the last '!!'.
Textarea as HTML tag is inserted incorrectly. You should change your code as follows:
My Editor:<br>
<textarea name="article-ckeditor" id="article-ckeditor"><p>Initial editor content.</p></textarea>
<script>
CKEDITOR.replace( 'article-ckeditor' );
</script>
Also in your controller, there is no function called Input, it's input. Change your controller as follows:
public function gettopics(Request $request){
$topic=new Topic;
$topic->title=$request->input('title');
$topic->detail=$request->input('detail');
$topic->save();
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745135934a4613197.html
评论列表(0条)