Answer the question
In order to leave comments, you need to log in
Laravel 5.8 why is the text encrypted when added to the site?
there is a template for adding text to the site
@extends('default.layouts.layout')
@section('content')
<div class="col-md-9">
<div class="">
<h2>Добавление нового материала</h2>
</div>
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if (session('message'))
<div class="alert alert-success">
{{ session('message') }}
</div>
@endif
<form method="post" action="{{ route('admin_add_post_p') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group">
<label for="name">Заголовок</label>
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }}" placeholder="Заголовок">
</div>
<div class="form-group">
<label for="img">Изображение</label>
<input type="text" class="form-control" id="img" value="{{ old('img') }}" name="img" placeholder="img">
</div>
<div class="form-group">
<label for="text">Text</label>
<textarea class="form-control" id="text" name="text" rows="3">{{ old('text') }}</textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
@endsection
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\User;
use Auth;
use Gate;
class AdminPostController extends Controller
{
//show Form
public function show() {
return view('default.add_post',['title' => 'Новый материал']);
}
//new post
public function create(Request $request) {
if(Gate::denies('add-article')) {
return redirect()->back()->with(['message'=>'У Вас нет прав']);
}
$this->validate($request,[
'name'=>'required'
]);
$user = Auth::user();
$data = $request->all();
$res = $user->articles()->create([
'name' => $data['name'],
'img' => $data['img'],
'text' => $data['text']
]);
return redirect()->back()->with('message','Материал добавлен');
}
}
"\u043f\u0440\u0438\u0432\u0435\u0442"
"00000000"
Answer the question
In order to leave comments, you need to log in
It's not a cipher, it's an encoding. This is how Russian characters are written to the database.
"\u043f\u0440\u0438\u0432\u0435\u0442"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question