Answer the question
In order to leave comments, you need to log in
Laravel error 500?
Just started learning the framework. I smoke docks. I can not understand what I'm doing wrong, I've been suffering for two hours already.
There is a post plate, there is a Post model
<?php
namespace App\Models\Post;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'post';
}
<?php
namespace App\Http\PostController;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Models\Post;
class PostController extends Controller
{
/**
* Display a listing of the posts.
*
* @return Response
*/
public function index()
{
$posts = Post::all();
return view('post.index', ['posts' => $posts]);
}
}
Route::get('posts', ['as' => 'posts', 'uses' => '[email protected]']);
use App\Models\Post;
public function index() {
$posts = Post::find();
return view('home' => [$posts] => $posts);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question