mstnorris
4 years ago
241
65
General

Guidelines for posting on Laracasts.com

Posted 4 years ago by mstnorris

I have started this thread for everyone to favourite and share with others when the OP doesn't conform to, well, these guidelines. They are not meant to be hard and fast rules but as the title suggests, guidelines. If we all start on the same page then it is much easier to help one another.

If you're completely new here then I suggest taking a few minutes to read over this post before posting anything yourself. You won't always need to include examples from all of the information contained here but it is a good starting point.

Before you start

Try running composer dump-autoload -o (It's like turning your computer off and on again, it works wonders!)

Have you already looked?

Most things can be solved with a quick Google search, if you want to see if your question has already been asked then search the forums using Google by adding this before your search term:

site:laracasts.com/discuss

Don't hijack an existing thread

For things like Feature Requests, and Simple opinionated discussion this is ok. But for "How To" and "Code Review" type questions please start your own. Of course, where appropriate reference the existing question but do start your own thread. The reason being that it can become confusing very quickly as although you might have the same problem, you may not require the same solution. (Experience Points* can only be awarded to one person although multiple people may already be helping out; but this is beside the point. Just start a new thread; it avoids confusion.

How do I ... (v5.1.0, v5.0.32, v4.2.*)

Give it a meaningful title, include clearly what version of Laravel you are using.

Note: To see which version of Laravel you're using excatly, execute the following command within your project. It's the first thing to be printed out.

php artisan --version

Are you using Homestead?

No? Why not? Oh ok, well, if you're not, please say what you're using instead; MAMP, WAMP, XAMPP etc.

Which OS

Tell us what operating system you're using as your host machine; are you using Mac OS X (10.10.4), or Windows 8, Windows 7, or a Linux box?

Choose the right Channel

Jeffrey spent a long time deciding what channels to include to make it easier for us to help one another so lets keep up that trend.

"Tips" is for posting tips to share with the community, not for asking for tips on how to do something.
"Site Improvement" is for bugs/improvements to the Laracasts.com website. Not yours.
"Requests" is for lesson requests not requests for help.

Stick to one question

When asking for help, as this guide explains, keep it concise and to the point. Try to keep it to just one question per post. Similar to the S in SOLID, a post should contain only one question. When it is answered, mark it as so and if you need to follow up and you start to deviate far from the original, ask a new question.

Look at the bigger picture

The XY problem is asking about your attempted solution rather than your actual problem. This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

Please state clearly and concisely what it is you're trying to achieve, many of us are good at looking at code and finding bugs within it however a lot of the time your lives could be made simpler by taking advantage of a feature of Laravel that you're unaware of. Concentrate on your end goal and we'll try our best to help you with the rest.

See The XY Problem for more information.

Be specific

Honestly, we can't help you if you're not specific. All too often great answers are given and then the OP specifies some other constraint. (Worse if they say later down the line that their using a different version of Laravel). Yes, you could say, the guys helping out shouldn't assume, but come on, give us a break, we're helping you. So help us.

Errors and Exceptions

Firstly, if you receive one of these, I feel bad. It's horrible. But you can help yourself. Copy and paste the error message into your text editor and strip out all of the personal stuff that would only be shown on your machine.

For example, the following exception, when put into Google yielded No results. (Thats ZERO results).

[ErrorException]
Argument 2 passed to Illuminate\Mail\Mailer::send() must be of the type array, null given, called in /home/vagrant/Code/laravel/app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 216 and defined

From the above, the location of the file in /home/vagrant/Code/laravel/app/ is specific to my installation. If I remove that part and leave it as:

[ErrorException]
Argument 2 passed to Illuminate\Mail\Mailer::send() must be of the type array, null given, called in vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 216 and defined

I got many more results that are likely to help me.

Likewise, with these somewhat more generic errors, a quick Google search yielded some useful topics.

Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:

If that doesn't help, come back here and ask a question.

  1. Copy and paste the Exception. (see style guide below)
  2. Copy and paste the code from any file that the error relates to. (see style guide below)

Provide code

When asking a question, provide your code. Don't waste your time typing it out. Copy & paste it, the reason for this is when you type it out you are more likely to make small spelling mistakes and other simple syntax errors which is misleading. Anyone answering your question will always try to point these out when in actual fact they may not be the issue, you might have just typed it out wrong. So avoid it. If you happened to have a mistake or syntax error in your code, then at least that is an issue that we can solve.

An even better way is to copy it and paste it into SublimeText or your editor of choice and tidy it up so that it is nicely formmated. Then when you come to include it in your question, you can do so very easily by wrapping it within ```. Do you like looking at badly formatted code? Neither do we.

External Resources

Markdown Basics
GitHub Flavored Markdown

Example One: Basic

```
<?php
public function doSomething() {
    return $this->doesSomethingElse();
}
```

This will be rendered like so:

<?php
public function doSomething() {
    return $this->doesSomethingElse();
}

Example Two: Syntax Highlighting

To add syntax highlighting, just add the language after the three backticks like so.

```php

<?php namespace App;

class User extends Model {
    
    protected $fillable = [
        'name',
        'email'
    ];

    public function profile()
    {
        return $this->hasOne('App\Profile');
    }
    
}

Note

Make sure that you close your code tags

Document that code

Tell us what we're looking at. If you look at most of my questions and responses on here you will see that I utilise <h3> tags a lot alongside the <small> tag. It works great!

How

<h3>User <small>model</small></h3>

Example

User model

Verified Middleware

PagesController controller

Ok, I guess this one is over doing it, but, it is nice to be explicit and get in the habit.

Database schema

Tell us the structure of your database:

  1. Are you sticking to the naming conventions?
  2. What is the column type? int, string, text, boolean?
  3. Provide Markdown Tables or a link to Laravel Schema Designer.

Using a third-party package?

If you're using a third-party package, include a link to the GitHub repository and the appropriate documentation to which you have already been referring to. It saves us from having to search for it. (This helps as many packages share very similar names, so make sure we're looking at the right one!)

Links

To add a link you can use the normal <a> but that's long winded. Try square brackets to house the link text like so [link to url] followed by the (actual url in parentheses).

[ Link to url ]( http://laracasts.com ) Note remove the extra whitespace, I had to add it to show you the syntax.

Including images (where appropriate)

I recommend using a service like imgur. You can very easily upload images to their site and once you've done that, they will provide you with standard links directly to those images. Then you can include them as you would normally with the standard HTML IMG tag

Is it homework?

Let us know if it is homework or not. Simple.

Do not BUMP

With the exception of this thread which you are all welcome to bump at all times so to keep it on the front page ;)

If your question hasn't got any responses from any of us, there will be a reason. It isn't that we haven't seen it. By this I mean don't simply reply with the word Bump or similar, instead add a new reply and supply more information, that will in turn put you back on the front page.

  1. Start from the beginning, what are you trying to achieve?
  2. What have you tried?
  3. Where are you stuck?
  4. Follow all the points I've already mentioned above and we'll do our best to help.
  5. If too much time has passed you may not be able to edit your original post, that's ok. Add a new reply and supply all the details listed here.

No +1s

Well, as it is currently not possible to "thumbs up" the original post, I guess it is acceptable for there to be one "+1" or similar, form then on, people should "thumbs up" that reply otherwise what could be a conversation; it just turns into a long mess of "+1" and "me too!".

Be polite

This forum is not a commercial platform. As such contributions from other users to help you on your code issues or advice on how to solve "complications" are done as an unpaid effort by these users. As such, respect that someone actually did take time to open the thread, read your question and type out an answer.

There isn't much else to say here.

Accept answers

If someone has taken the time to help you out, the least you can do is show your appreciation by marking it as solved. To do this just click the check/tick ✓ mark. Do not mark your own response as answered unless you've actually taken the time to format a correct answer, you won't gain experience points either.

Replying and answering

I feel that this is just as important as the original post. When replying to someone don't just blindly give them an answer, let's all be good developers and ask more questions. The 5 Whys spring to mind.

Ultimately, if the OP isn't forthcoming with information, ask them questions, if not for them, for all the others who find the thread months/years down the line.

Always provide links to the Laravel Docs specific to the version number that the OP is using (hopefully these won't change). This is because the Laravel documentation is some of the best out there and it is only getting better. When you give an answer and show it alongside examples from the documentation, other's will think to look there first, it is also a gentle introduction to the documentation for some people too.

Things of interest

Thank you

Honestly, thank you. If you made it this far I salute you. Please share with others by copying the link below.

[Guidelines](https://laracasts.com/discuss/channels/general-discussion/guidelines-for-posting-on-laracastscom)

This is still in development so I will try to add more as your suggestions and edits come in.

Please sign in or create an account to participate in this conversation.