S
S
Stasik092017-11-24 09:08:12
css
Stasik09, 2017-11-24 09:08:12

Error when editing an author's book, how can I solve it?

Here is the error itself:

General error: 1366 Incorrect integer value: 'PUT' for column 'author_id' at row 1 (SQL: insert into `book_author` (`author_id`, `book_id`) values (PUT, 1))

update and edit function:
public function edit($id)
    {
        $book = Book::find($id);
        $author = Author::all()->pluck('name', 'id')->toArray();
        return view('book.edit',compact('book', 'author'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $book=Book::findOrFail($id, ['id']);
        $book->authors()->sync($request->except('authors'));

        return redirect()->route('books.index', compact('book'))
            ->with('success','Книга обновлена');
    }

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
sergski, 2019-09-06
@Relow

V
Vitaly, 2019-09-06
@ya-vitaliy

write a function in js that will wrap each word in a span and set a background for all these spans (well, other styles).

A
ArtemGum, 2019-09-06
@ArtemGum

mark tag and style it

A
Alex, 2019-09-06
@motosasha

there are many solutions
https://css-tricks.com/multi-line-padded-text/
the most-most IMHO through box-decoration-break

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question