This is the error:
"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'codearte_site.posts' doesn't exist (SQL: select count(*) as aggregate from
posts )"
It happens to me with all the projects that I have in laravel on the pc, always the same eror
'codearte_site.<table_name>'
web.php file
Route::prefix('api')->group(function () {
Route::prefix('post')->group(function () {
Route::get('list', 'PostController@list');
});
});
PostController.php file
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Post;
class PostController extends Controller
{
public function list(){
return response()->json( Post::paginate(10) );
}
}
Post.php file
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $fillable = ['title', 'content', 'slug'];
}
.env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=codeartes
DB_USERNAME=root
DB_PASSWORD=root
I do not know where else to review, I turned off the MySql and turned it on ... I do not know what to do.