Skip to content

u/path411

In this archive from Mar 2011 to Mar 2021

0
posts
41
comments
0
media
106
score

This method is eloquent's implementation for handling the failure of inserting duplicate records, already. Yes, in the real world you will typically have a unique constraint already, but adding it to OP's example will still have an unintended outcome.

Calling firstOrCreate should always give you back an instance of the model, whether it's a new record or an old one. Adding a unique key to OP's case would cause the consecutive jobs to throw an error instead of selecting the existing record, when it should return the already created instance.

2 points

Sure, I can come up with a small list pretty easily. Most of my complaints come from Eloquent and trying to work with large data sets.

Forced to do disgusting hacks and plenty of DB::raw() to build queries because functionality like having a subquery in your from isn't implemented. I've seen queries that luckily work despite mergeBindings doesn't work correctly with subqueries.

Pluck is the only way to build a query from a model without it creating an instance of every single record. Pluck then only allows 1 column. If you need to get an array of 2+ columns from a large data set, you will very easily run out of memory.

Maybe I'm missing something, but I don't understand why eloquent timestamps are implemented in the models instead of just in SQL. Gets really annoying if you have multiple applications hitting the same table. Have to instead manually set up the default/on update timestamps.

I also wish there was integration with cache or even redis directly, with eloquent.

There are other issues that I've seen on github that shows Laravel breaking basic standards yet getting negative responses from maintainers. My recent favorite I've seen is: https://github.com/laravel/framework/issues/22125 Had the same issue where data such as product/manufacturer names have slashes in them, but breaks routing even when escaped.

2 points

So then jobs where you call firstOrCreate after it has been created just error instead of getting first?

This is the exact kind of response that shows how broken Laravel is right now. Their response to everything broken is "I've never run into this while programming my single page blog, you should hold it different". After heavily using Laravel for the past year, it's very obvious Laravel is years away from anything "enterprise ready".

2 points

Yeah, I'll never understand why that one failed. It really puts a salty taste in my mouth when the people directing the language are so out of touch. This is a feature all or almost all competitors to PHP have. The addition of type hinting has made this an even worse problem for me recently as anonymous functions can become really bloated now.

2 points

The ability to chain array methods prevents bloat. My 2 examples were both places where PHP causes you to write a lot of bloat to attempt to do simple things. They wouldn't have to remove the old weird global methods, but saying using a modern approach at working with arrays is a disadvantage sounds really odd.

2 points

There are some pretty ridiculous things PHP still does. Arrays still have no base library or something similar to laravel collections or I assume what every framework has to add. Like how does a language just not have usable arrays?

And then on top of it, no shorthand anonymous function syntax still kills me.

1 points

I would try something like http://pixelnovel.com/ first tbh. I've seen it and competing products around (I haven't used any of them, this isn't a recommendation of pixelnovel or any specific product, that was just the first one I found while searching).

There seems to be a few of these products that sit on top of a rcs and give some nice photoshop plugins to give a lot better use for a designer. I don't see how these wouldn't be immediately better than using just an rcs.

Version control/etc is one of these techs that have been around forever for developers and would be hugely beneficial for a large number of people in other areas.

1 points

While I'm creating new apps in laravel, I'm not so unhappy with CI that I would rewrite all my already existing apps.

I hope their first order of business is adding in some much needed functionality though and having it be non-breaking.

5 points

You are right to be cautious, but with the correct mindset, a framework can be an incredibly useful tool to learn from.

I find that I can read and understand code written that way most of the time. I just find it hard to initiate coding in OOP in any meaningful way.

Makes me think that you are at a place that using a framework will help teach you this. If you find a good framework, it should allow you to see how more experience programmers use OOP to solve their problems.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.