تماشای این درس نیاز به اشتراک حرفه‌ای دارد.

Fresh Clone Setup0:22

So, let's answer his question and close out that issue, and now we're back to zero. Okay, anyways, I'm going to clone this from scratch and run through the entire process myself to figure out, okay, what exact steps need to be followed. So in my code directory, I will clone this down, and this is something I'd make a note of. Step one, clone the directory. Step two, create the database. All of that stuff. Now, actually, on that note, though, if we switch back, we're going to need a specific .env file, but the example one for our repository is still just the generic one.

Creating a Generic .env0:45

Now, actually, on that note, though, if we switch back, we're going to need a specific .env file, but the example one for our repository is still just the generic one that Laravel ships with. Now, if I go into the old form series and we cat the .env file, you'll see there's references to things like reCAPTCHA and Algolia and MailTrap, so a number of things. So why don't we just cat that and pipe it to ppcopy. This is just the geeky command line version of copy that file. Okay. So now let's go into Console and open this within my editor. So here, if we go into environment.example, I'm going to just paste in the one that we

So now let's go into Counsel and open this within my editor. So here, if we go into environment.example, I'm going to just paste in the one that we had before. But, of course, things like your actual keys, these are just local keys, so they're safe, but I don't want to share those and distribute those on GitHub, so we would need placeholders to let you know, hey, you need to set up reCAPTCHA on your end. You would need to set up potentially MailTrap if that's what you want to use. So let's go about making this generic. First, the URL, well, we could call that counsel.dev. What next?

Database and Mail Config1:46

First, the URL, well, we could call that counsel.dev. What next? The database connection. So why don't we assume a database name of counsel, and often your username will be root with a password of blank, locally at least. Otherwise, you can update that to your credentials. So on that note, in SQL Pro, I'm going to add a new database called counsel. Okay. Now that exists. What else?

Now that exists. What else? Mail host. Now, MailTrap is a neat service for testing actual mail locally. So it's an SMTP server that Laravel will send email to, and then you can see exactly what that mail will look like. But maybe we don't force that. Maybe locally, we're just going to log the email. Okay. So we'll empty those out, and if you want to use MailTrap, you can fill those in.

I have to do 30 different things. So all little mental notes we need to make, how can I make this simpler? At the moment, you can see right here, hmm, yeah, this is where we paste the reCAPTCHA section into the form. So at the moment, the user would have to do that. I'd prefer that to be like a configuration key so that they never even have to track this file down. So these are all ways that we can improve things. Anyways, if we switch back, Algolia. So you know what, they can use that if they want, but if we go to config/scouts

Install Dependencies and Debug4:12

Anyways, if we switch back, Algolia. So you know what, they can use that if they want, but if we go to config/scouts right here, yeah, maybe locally, we'll set the scout driver to null so that it never even interacts with Algolia. That will be optional. Okay, great. So I think this is looking okay to me. Let's go ahead and run composer install to pull in all of the various dependencies. And again, I'm making a mental note of what needs to be done to get this up and running. So in Safari, I'll go to council.dev, and we get the dreaded white screen of death.

And again, I'm making a mental note of what needs to be done to get this up and running. So in Safari, I'll go to council.dev, and we get the dreaded white screen of death. If you've ever run into this, it can be really confusing because you have no idea where to start. But I promise almost in all cases, it's related to your .env file. So in our case, it's not reading any .env file. Let's come back and rename this to .env. Okay, so if we give that a refresh, we may get an error, but at least now we've moved on to something new. We're not seeing a dreaded white screen of death.

So if we give that a refresh, there we go. That means John Doe can browse. He will be the only one to see that there are no threads on the forum at this point, but he can create something. But now we don't have a channel yet. And in fact, at the moment, there's no administration section for the forum, and that will be one of the main features that we implement as part of this series. Until then, they would have to visit their channels table and manually add it. How about php? And then another one, maybe it's a web development forum.

How about php? And then another one, maybe it's a web development forum. Like so. All right, now we do caching. So one of the steps is after you've taken all the installation steps, clear your cache so that everything takes effect. Give it a refresh. So he has a php-specific question. Help me with this, please. He pastes in some kind of code snippet.

And I'll fast forward. Okay, so we'll submit that issue. And now at some point in the series, we will resolve that issue. Okay, but anyways, until then, the user will mark, they will click on the email to mark their account as confirmed, and we can try it again. And ta-da! With ScreenCast Magic, you don't have to wait. And there we go. John's question has been created. He can edit however he needs to.

Writing Installation README8:05

Ta-da! All done. So if we want to look at a markdown preview, here's at least my very first version of the README that we will, of course, flesh out quite a bit. So step one, we need php installed. We will clone the repository, cd into it, install our dependencies, and then generate a key. All right? Step two, create a new database, and then reference it within your .env file. Next, step three, sign up for a free Recaptcha account.

Step two, create a new database, and then reference it within your .env file. Next, step three, sign up for a free Recaptcha account. Here's the link. Here's what you will type in. Images are always useful in these cases. Often you will assume the user understands where to fill something out, and they don't. They can't even get your thing installed because the basic README wasn't specific enough. So images can be very useful. And then they need to paste their generated key in secret into their .env file. Step four, create any number of channels, clear your cache, and you're all set to go.

And then they need to paste their generated key in secret into their .env file. Step four, create any number of channels, clear your cache, and you're all set to go. Now, the only thing I haven't done, though, is you'll remember, as part of the Recaptcha setup, one of the weird things we had to do is visit our thread/create and paste in that little snippet. But if you see here, it's just referencing the site key. So notice 6LDF is what it starts with. And you'll see here is that key. So that means we don't have to force the user to paste in a snippet. We can do that dynamically once they fill this out.

Move Env Vars to Config9:24

So that means we don't have to force the User to paste in a snippet. We can do that dynamically once they fill this out. However, as a rule of thumb, you never want to reference your environment variables directly. Instead, a recommended approach in Laravel is to create a config file. The config file can reference these environment variables. But then anywhere else in your application, you will reference the config value, not the environment variable directly. So that means, hmm, why don't we create a new file here, and this will be our console-specific configuration. So any of these, like this is cache-specific configuration, this will be our project-specific

We're actually kind of doing two things at once. So I'm going to push this up as a separate commit, and that way the User never has to worry about it. Within our threads create, yeah, take a look at this. So if we empty that out and we come back to Safari, yeah, notice we don't even see the Recaptcha key. However, if we bring it back, of course we see it, as you see there. But yeah, now instead, I'm just going to reference that config file. So console.recaptcha.key. And if I give this a refresh, that's all working.

There's still areas where we need to simplify things and clean it up, but this will get us started. So I'm going to view my git status, and let's break this up. So you know what? I'm going to use a GUI just to make it a little more visual for the screencast. Here we go. So let's separate this into specific commits. So we have one where we simplified how we reference the recaptcha key. So to do that, we added this new config/console.php file. So those two are connected.

So to do that, we added this new config/console.php file. So those two are connected. So I will simplify recaptcha key reference. And you can even add a description, and this is useful if you want to clarify things a bit more for anyone reading the commit. This way, users don't have to manually paste in the recaptcha HTML snippet. And we'll commit that. Okay. So yeah, environment.example. So here's the thing.

So yeah, environment.example. So here's the thing. We need to... let's close this out. We need to tell the user what kind of environment file to create, but I also need to be able to maintain one on my own locally. This is why we usually name it environment.example. So we'll create that, and then I'm going to have a new file called .env and paste that in. Okay. So here's what I specifically will use, and you'll notice that, again, that file is being

Like so. All right. That looks good to me. So add .env file. composer.lock. I will discard that for the time being. And then finally, we have our README.md. But actually, one thing we have to do now is tell the user to rename .env.example to .env. So what we could do is add that as part of our step one.

.env. So what we could do is add that as part of our step one. And this is just saying move or rename .env.example to .env. That way, the user can just copy this, paste it in, and they don't even really need to think about what it's doing if they don't want to. All right. Anyways, back to GitHub. Add README installation instructions. And we'll add that. Commit it to master.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟