If it's working on local then check your case, Linux is case sensitive.
And maybe do some echo and dd to see what's happening.
I am getting a 401 Unauthorized page after trying to Edit the content of my website
Controller
public function update(Request $request, News $news)
{
if(auth()->user()->id !== $news->user_id){
abort(401, "Please Login");
}
$this->validate($request,[
'body' => 'required|min:20'
]);
$news->update($request->all());
return redirect()->route('news.show', $news->slug);
}
Form
<div class="news-form">
<form action="{{route('news.update', $news->slug)}}" id="postform" method="POST">
{{csrf_field()}}
{{method_field('put')}}
<div class="news-subject">
<b>Body:</b>
</div>
<textarea name="body" class="form-control my-editor">{{$news->body}}</textarea>
<script>
var editor_config = {
path_absolute : "/",
selector: "textarea.my-editor",
height : "300",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
relative_urls: false,
file_browser_callback : function(field_name, url, type, win) {
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
if (type == 'image') {
cmsURL = cmsURL + "&type=Images";
} else {
cmsURL = cmsURL + "&type=Files";
}
tinyMCE.activeEditor.windowManager.open({
file : cmsURL,
title : 'Filemanager',
width : x * 0.8,
height : y * 0.8,
resizable : "yes",
close_previous : "no"
});
}
};
tinymce.init(editor_config);
</script>
Please help because it works fine on localhost
so maybe drop the comparator from !== to != or change one of the columns to match the other
Please or to participate in this conversation.