Git Product home page Git Product logo

Comments (4)

jacurtis avatar jacurtis commented on July 19, 2024 2

I was unfamiliar with the $this->validateWith() method. I did not know it existed which is the simple reason i have not used it. I will probably incorporate that soon. It is a nice little shortcut. It always felt dumb manually adding the $request into it since that is what you are validating 99% of the time.

I get asked about Mass assignment a lot. The reason I don't use it is simple. Because I teach this stuff so much (both online and locally) i generally avoid teaching newcomers about mass assignment. Newcomers don't do well with "magic" methods that do a lot of hidden work behind the scenes. So showing them manually setting them is good so they can see how it works. There are also times when you really don't want to do mass assignment (or you need to put in some more complex work to make it work) such as when you are filling in non-mass-assignable fields. So i have moved away from teaching mass assignment to beginners, because it is a major point of confusion for them and makes teaching something like saving a new record in the database take a day instead of an hour.

Because much of my coding is teaching, and because i avoid teaching it, I have gotten out of the habit of using mass assignment even in personal projects. I don't hate mass assignment, i have nothing against it, and I agree it is far more elegant. But like I said the teaching methods I do so often get engrained as habit for me and eventually bleed over into my more personal projects. Behind the scenes mass assignment is doing the same thing I am doing manually, so it doesn't save on things like performance. Just cleanliness of the controllers.

If you wanted to work on it and submit a PR i would look it over and likely approve it. Now is a good time since we have now completed Permission and Role. We also will probably not add anything to the User model for another week or so. So its a good time to make those changes.

Thanks for contributing

from devmarketer.

carusogabriel avatar carusogabriel commented on July 19, 2024

Hey @jacurtis!

Can I submit some refactored code (I've already submitted one (#5)), as now this project is in Laravel's 5.5 version? Or no, wait until the series end?

from devmarketer.

jacurtis avatar jacurtis commented on July 19, 2024

It is now in version 5.5. Go ahead and submit the code and ill review it.

from devmarketer.

jacurtis avatar jacurtis commented on July 19, 2024

Ive approved the changes in PR #5. Ill close this for now. Open up a new issue or pull request if you have other changes. THanks

from devmarketer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.