nschiffelbein

nschiffelbein

Member Since 5 Years Ago

Experience Points 800
Experience Level 1

4,200 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 27
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.

18 Dec
4 years ago

nschiffelbein started a new conversation Polymorphic Relationship With Split Type/ID Tables

I have a unique table structure that I'm struggling to get relationships established between. I understand the traditional polymorphic many to many relationship and see how that applies, however because of my project requirements the type for the relationship is stored in a related table in relation to where the IDs are stored. To illustrate a little more clearly here are some table stubs:

customer

id, name

customfield

id, name, customizable_type

customfieldvalue

id, customfield_id, customizable_id, value

I have a relationship established between customfieldvalue and customfield and if I could do something like customfield.customizable_type in the relationship this would work perfect. Unfortunately it appears that the table name is hardcoded to be the same in the morph helper functions. Any thoughts on how I might accomplish this? I'm thinking I'll need to override the morph class or create a custom version of it for the related objects. My goal is to be able to get the customfieldvalues from the customer object.

03 Nov
4 years ago

nschiffelbein left a reply on Where Are You All From?

Orange County, CA

29 Oct
4 years ago

nschiffelbein left a reply on Laravel CORS Best Practices And JWT

@hfalucas I found an old post by someone that hacked around CORS on Laravel. NOTE: This is not something I would use in a production environment as it leaves you wide open to cross site requests, but for an internal dev environment until the CORS plugin is updated it should do the trick. Add the following lines to the top of your bootstrap/app.php file:

header('Access-Control-Allow-Origin : *');
header('Vary: Origin');

if (PHP_SAPI != 'cli' && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
    header('Access-Control-Allow-Methods : POST, GET, OPTIONS, PUT, DELETE, HEAD');
    header('Allow: POST, GET, OPTIONS, PUT, DELETE, HEAD');
    header('Access-Control-Allow-Headers : X-Requested-With, Content-Type');
    exit();
}

Unfortunately I don't have any experience with JWT, so I don't have any input on that.

nschiffelbein started a new conversation L5 Paginator Total Missing

Are there plans to re-introduce the total number of records in the Paginator? I'm specifically after it in the JSON response. The current response is as follows:

{
    "per_page": 100,
    "current_page": 2,
    "next_page_url": "http:\/\/laravel.com\/endpoint\/?page=3",
    "prev_page_url": "http:\/\/laravel.com\/endpoint\/?page=1",
    "from": 101,
    "to": 200,
    "data": []
}
26 Oct
4 years ago

nschiffelbein left a reply on Laravel CORS Best Practices And JWT

barryvdh/laravel-cors is a great plugin, however, once the Middleware piece of Laravel was updated for version 5 the plugin stopped functioning. I spent some time trying to get it updated, but without success. I have opened an issue with the package maintainer and he said it would be updated when Laravel 5 reaches beta status.

24 Oct
4 years ago

nschiffelbein started a new conversation UnitTesting Error On Current Laravel/laravel

Is anyone else receiving an error about a missing $client variable when trying to run unit tests on the current version of the laravel base code? It appears that the AssertionsTrait relies on a $client variable where it's included which isn't present.

19 Sep
4 years ago

nschiffelbein left a reply on Command Bus Stuff In Laravel 4.3

@BenSmith I like your approach. Two things that I ran into while implementing this on a new project:

The toCommand function only needs to generate the Command class name and validate it prior to sending it into the execute method. Jeffrey's CommanderTrait will use the ReflectionClass to instantiate the provided command. By using the CommanderTrait in this way you can also ditch the static string for the Command name in your request class.

public function toCommand()
    {
        $class = str_replace('Request', 'Command', get_class($this));

        if (!class_exists($class)) {
            $message = "Command object [$class] does not exist.";
            throw new \Exception($message);
        }

        return $class;
    }

The second thing is you no longer need to pass additional parameters through the toCommand function since the execute method in the CommandTrait will accept override input data as a second parameter.

public function store(PublishStatusRequest $request)
 {
  $status = $this->execute($request->toCommand(), array_merge(Input::all(), ['user_id' => Auth::user()->id]));
        Flash::message('Your status has been updated');
        return redirect()->back();
 }

These changes make the code testable as well since passing an instantiated Command object to the execute method will cause it to be re-instantiated requiring you to pass your additional inputs to both the toCommand function and as a second parameter in the execute methods. Let me know if anything seems out of place or incorrect. I just completed a few functions with this approach and it seems to be working well, but if anyone sees an iceberg I haven't please let me know.

15 Sep
4 years ago

nschiffelbein left a reply on Custom Validation Function In Laravel 5

danielboendergaard, Thanks for your response and pointing me toward the trait. Overriding the validate function seems like it forces you to re-implement the core handling of valid/invalid data. Looking through the trait I saw the getValidatorInstance() method and came up with this solution based on a post here (http://mattstauffer.co/blog/laravel-5.0-form-requests):

public function getValidatorInstance() {
        $validator = parent::getValidatorInstance();

        $validator->after(function() use ($validator) {
            // Do check here

            if(// Invalid condition)
                $validator->errors ()->add('field', 'message');
        });

        return $validator;
}

Does this seem like a clean way to add the additional conditions or will overriding this method cause problems down the road?

nschiffelbein started a new conversation Custom Validation Function In Laravel 5

I would like to write a function in my FormRequest object to perform some custom validation steps in Laravel 5, but I can't seem to find a function to override/implement to perform these steps. What is the best approach to do something like that?