S
S
Sergey2015-12-29 15:17:12
MySQL
Sergey, 2015-12-29 15:17:12

Why is the auto-increment field filled in so strangely?

I'm trying to use Laravel.
Here is the controller I wrote:

public function store(Request $request)
    {
        $arr = $request->input('post');
        $post = new Posts();
        $post->create(['post'=>$arr]);
        return redirect('recommendations');
    }

Model:
class Posts extends Model
{
    protected $table = 'posts';

    protected $fillable = ['post'];
}

The form:
<form method="post" action="/addpost">
        <div class="form-group">
            <label for="post">Добавить запись:</label>
                            <textarea rows="10" name="post" class="form-control"></textarea>
        </div>
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <input class="btn btn-primary" type="submit">

Migration:
public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->text('post');
            $table->timestamps();
        });
    }

But the following is recorded in the database:
1036c5b41d58489dbe3f3d9c2cc91ed3.png
Tell me what is the problem? The database and the site are hosted on openwork.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Идель Гизатуллин, 2015-12-29
@sera527

Не нужно менять автоинкремент. Так задумано разработчиками MySQL.
Сдвиг в 10 значений добавили чтобы поддерживать master-master архитектуру и избегать коллизий.

Станислав Почепко, 2015-12-29
@DJZT

Скорее всего у вас для этой таблицы стоит шаг инкремента 10. Посмотрите в параметрах таблицы. Например через phpMyAdmin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question