You Don't Have to Delete Things Permanently

Sdílet
Vložit
  • čas přidán 25. 08. 2024
  • What would it look like if you wanted to build a "trash bin" for your application? That way your users don't permanently delete info every time they delete something.
    Laravel has something called Soft Deletes out of the box, so why don't we take a look.
    Links:
    Soft Delete documentation: laravel.com/do...
    Keep creating.
    ---
    📹 *Watch My VSCode Setup Video:* • My Minimal and Beautif...
    🎓 *Make VSCode Awesome - Caleb Porzio's Course (support me with this link):* gumroad.com/a/...

Komentáře • 21

  • @JonBrookes
    @JonBrookes Před měsícem

    amazing, yet another reason to use Laravel. I remember how arduous this was to do in apps without this built in. Thanks again Josh, another great vid. Another great feature

    • @joshcirre
      @joshcirre  Před měsícem

      Thanks Jon! I learned about Soft Deletes way too late, I did it all manually for an older application of mine, but no more! :)

  • @windows07
    @windows07 Před měsícem

    Great video as always, one of the first thing I learned was soft deletes

    • @joshcirre
      @joshcirre  Před měsícem

      So nifty! I haven't gotten to use them as much as I should!

  • @vasiovasio
    @vasiovasio Před 9 dny

    The autocomplete code in this video is INSANE!!!
    What is this? Plugin? AI?
    How can suggesting "Restore" and "Delete" links?!?

  • @glennraya
    @glennraya Před měsícem +6

    You're wearing a hat again Josh, please be a normal Laravel dev. 🤣😝

    • @joshcirre
      @joshcirre  Před měsícem +4

      I don't know if I can ever be a normal Laravel dev. 🥲

    • @glennraya
      @glennraya Před měsícem +1

      @@joshcirre 😂😂😂

    • @andreyaires226
      @andreyaires226 Před měsícem +1

      Bro's too gangsta to be a normal dev.

  • @ajzack983
    @ajzack983 Před měsícem

    2:49 I think laravel magically knows the table's name when u follow the migration naming convention.
    So the --table wasn't necessary

    • @joshcirre
      @joshcirre  Před měsícem +1

      Thanks for the clarification! Good to know. :) I always forget when the naming takes over and when specifying names/tables/models etc. is helpful

  • @davidhida6821
    @davidhida6821 Před měsícem

    thanks josh for your work. I really love your videos. Can we softDelete a model wich is related to another one ?

    • @joshcirre
      @joshcirre  Před měsícem

      I believe so! I have not tested it but I don't see why not. Soft Deleting just is a way to easily set up the "deleted_at" column. Any cascading that you have set up to delete other models don't run until the instance is completely deleted.
      BUT there might be ways of automatically Soft Deleting related child records in another model if that's what you're looking for too. :)

    • @davidhida6821
      @davidhida6821 Před měsícem

      @@joshcirre thanks josh. I will test it. Hope to see a video about database constrains in laravel. Thanks for your work

  • @michimarz
    @michimarz Před měsícem

    Can Laravel do event sourcing? Do you have a video on that or can recommend any?

    • @joshcirre
      @joshcirre  Před měsícem

      I’m trying out a Laravel Event sourcing package called “Verbs” right now. First foray into it all. I’ll have a video soon. 👀

  • @Netvirux
    @Netvirux Před měsícem

    Hi please I'm a PHP developer with experience in Laravel. I'm now exploring the possibility of integrating Laravel with React Native to build a website and a mobile application simultaneously. I'd love some guidance on how to get started with this project. Specifically, I'm unsure about how to create a mobile app using Laravel and React Native together.

    • @ifeanyinnaemego
      @ifeanyinnaemego Před měsícem

      Have tried it. You have to find a way to make your api URL secure. Ngrok can help you with that. I enjoyed that project

    • @zulfiqrysaadputra
      @zulfiqrysaadputra Před měsícem

      Use Laravel to build API and consume it inside your React Native apps.

    • @joshcirre
      @joshcirre  Před měsícem

      Using Laravel as a strict API is a good usecase for Laravel. There's even some Laracasts courses on how this would be accomplished, but I have it as a video idea here too. :)
      cir.re/suggest