Creating a database client connection
[00:00] If we open thinker using Sail, and create a user using the user factory, we'll see that we don't get any errors. We can even fetch the users, and here it is right here. That's because when we create an application using Sail, the database part is also taken care of. All we need to do is to connect to it.
[00:31] Here's how to do it. Open your database, client; in my case I'm using TablePlus, click create a new connection, pick mysql, create, and then here, on the connection name, you can type in whatever you want. I'll name it tallpal sail, leave the host and the port as they are, and to grab the username open your environment file, go to the db connection details, grab the username, grab the password, and the database name.
[01:17] Now we can test the connection, and since they are all green, we can click connect; and here it is; our database. And this is the user we've created using thinker.
-
1Setup a new project using Laravel Sail (macOS)02:33
-
2Executing commands inside your application containers02:20
-
Creating a database client connection01:30
-
4Testing emails with Mailhog02:35
-
5Changing the php version in Laravel Sail01:29
-
6Run Sail and Valet in parallel01:39
-
7Customizing Laravel Sail01:25
-
8Setup Laravel Sail for an existing Laravel application00:49
-
1Setup a new project using Laravel Sail (macOS)02:33
-
2Executing commands inside your application containers02:20
-
Creating a database client connection01:30
-
4Testing emails with Mailhog02:35
-
5Changing the php version in Laravel Sail01:29
-
6Run Sail and Valet in parallel01:39
-
7Customizing Laravel Sail01:25
-
8Setup Laravel Sail for an existing Laravel application00:49