public function posts()
{
$posts = Post::orderBy('id','desc') -> get();
return view('admin/posts', compact('posts'));
}
class Post extends Model
{
public $timestamps = false;
protected $table = 'posts';
protected $fillable = ['','title','content','image','category','date'];
public function category()
{
return $this->hasOne('App\Category', 'id', 'category_id');
}
}