here you are using view()->with('alert-success',.........), alert-success is normal variable, not is session variable
if($book->save())
{
return view('pages.book', $this->fetchData())->with('alert-success', 'books updated successfully.');
}
view()->with() and redirect()->with() is two difference things
view()->with() return $variable
redirect()->with() return session variable
so change the code to use redirect()
return view('pages.book', $this->fetchData())->with('alert-success', 'books updated successfully.');
and after post request (such as store, update), should use redirect()
because if use view(), erveryone can reload the page submit the data again