3
Migrate does not give any error and also get popular table normally with Seed. But when I try to extract data from my database, it does not work.
namespace App\Http\Controllers;
use App\Todo;
use Illuminate\Http\Request;
class TodosController extends Controller
{
public function index(){
$todos = Todo::all();
return view('todos')->with('todos', $todos);
}
}
The mistake I get:
"SQLSTATE[HY000] [1045] Access denied for user 'Homestead'@'localhost' (using password: YES) (SQL: select * from
todos
)"
My file . env:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:jvqNxaeClqTx0iU7pV9/oBo7Ca66CR8hAoga/Y236Qs=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=new-project
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
I’ve tried to use:
C:\Users\Antony\Desktop\todos\blog>php artisan config:clear
Configuration cache cleared!
But it continued the same thing. Does anyone know how I can solve this?