Sturm

Sturm

Member Since 2 Years Ago

Experience Points
9,030
Total
Experience

970 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
89
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 2
9,030 XP
Aug
13
2 months ago
Activity icon

Commented on Color IDE

As of February 24, 2017, both the ColorIDE repository and its sister respository, ColorTree, have been closed.

Jul
30
2 months ago
Activity icon

Commented on Don't Forget Readability

I get Jeffrey's point toward the end of the lesson about making your code succinct, readable, and easily understandable. However, I disagree that it should replace commenting, no matter what.

I'm a strong believer in the saying, "always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." Which meansin addition to cleaning up your codethat you should comment up your code until someone looks over your shoulder and says, "That's probably too much."

Sep
27
2 years ago
Activity icon

Started a new Conversation Migration General Error: 1215 Cannot Add Foreign Key Constraint

I'm getting this error now when attempting to run a migration and I cannot, for the life of me, figure out why. I've spent time researching it and it appears that this is a very common issue with several different solutions. Unfortunately, none of the solutions I've found apply in my case.

For example, one solution suggests that the foreign key constraint is being created too soon--either before the column is created or even the table itself. Another suggests that the column to which the foreign key constraint is being applied doesn't match the reference table's column precisely. And the list goes on. Sadly, these don't appear to have any bearing on my situation, so I'm hoping someone here can help.

I have a lookup table called item_statuses (As I understand it, table names should be plural and snake case) that I recently created and populated with a few records. I also have a line_items table that has existed for years and has many records. I'm attempting to run a migration that adds a column to the line_items table, referencing the primary key of the lookup table. It then adds a foreign key constraint to that new column.

I've checked to make sure the datatypes are the same, that the column is created before the constraint is added, and that the naming of everything is consistent with guidelines. I honestly cannot figure out why running this simple migration is giving me a General error: 1215.

Here is the up() method of the migration:

    public function up()
    {
        Schema::table('line_items', function (Blueprint $table) {
            $table->string('item_status_id')->nullable()->after('machine_num');
        });
        Schema::table('line_items', function (Blueprint $table) {
            $table->foreign('item_status_id')
                ->references('id')
                ->on('item_statuses');
        });
    }

Can anyone please help me discover what I'm not seeing?

Aug
28
2 years ago
Activity icon

Replied to Saving The Opened/closed Status Of A Sidebar

Thanks for the fast replies, @jlrdw and @Cronix! As it turns out, I probably shouldn't be using PHP for this task, after all. Since there's already a handler for this event in the admin template's JavaScript file, I figured I would just take advantage of that and use a JavaScript cookie. So I set about adding the JS-Cookie library to handle it.

However, after investigating the function that handles the sidebar toggler, I see that this admin template author has already been using the JS-Cookie library and, indeed, storing the sidebar state with each click. He even had code for retrieving that cookie and adding the appropriate class to the <body> tag; it was just commented-out. So I uncommented it and it seems to work, just with a delay. That is, the page then loads with the sidebar open for a second, then it collapses, presumably once it reaches that point in the code.

I think I’ll be okay with the delay, though. I don’t know what else to do about it, but it probably won't be a huge deal. Thanks again!

Activity icon

Started a new Conversation Saving The Opened/closed Status Of A Sidebar

This seems like the kind of problem that's been solved a hundred times over, but since I'm a n00b, I need some hand-holding.

I've got a sidebar that opens/collapses when a hamburger icon in the header is clicked. This is obviously accomplished in JavaScript. However, going to another page (route) resets the sidebar back to its default--opened.

There must be some way to store the user's preference if they want the sidebar collapsed so just icons in it are showing. My immediate thought is to use a SESSION variable. If that's not a good idea, then perhaps a cookie. If that, too, is not considered a good practice, then can someone please tell me what is?

More importantly, however, is where to store the variable. I've pretty much already got the how from the Laravel docs and from many Google searches (i.e., session(['sidebar_status' => 'page-sidebar-closed']) or Cookie::make('sidebar_status', 'page-sidebar-closed'). What I cannot find nor figure out is how to have the app detect when a user clicks/taps on the hamburger icon/button, read whether or not the 'page-sidebar-closed' class already applied to the tag, then reverse that and store it somewhere (session, cookie, whatever) while also allowing the JavaScript to execute and perform the action. The stored variable can then be read back into the tag's class list as either an empty string or a the 'page-sidebar-closed' string.

I've been told there's no need to create a Controller for this, and I haven't yet gotten any answer on whether or not I need to create and Event/Listener combo. Although I doubt I should do that for just a simple thing like this. So what's the step-by-step that I'd need to for this? Again, I apologize in advance for such a simple request from a newcomer.