Why am I getting undefined variable post error?
My controller file is:
class CommentController extends Controller{
public function index(){
$post = Comment::all()->toArray();
return view('layout_frontend.readmore',compact('post'));
}
and my view file is :
<div class = "row">
@foreach ($post as $row)
<div class = "comment">
<p> </p>
<br><p></p></br>
</div>
@endforeach
</div>
my routes are:
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/blog', 'BlogController@blog')->name('blog');
Route::post('/readmore', 'CommentController@store')->name('store');
Route::get('/readmore', 'BlogController@readmore')->name('readmore');
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3x7gDh4
via IFTTT
Aucun commentaire:
Enregistrer un commentaire