SyntaxFix
Write A Post
Hire A Developer
Questions
If the table has date field, this(User::orderBy('created_at', 'desc')->first();) is the best solution, I think. But there is no date field, Model ::orderBy('id', 'desc')->first()->id; is the best solution, I am sure.
User::orderBy('created_at', 'desc')->first();
Model ::orderBy('id', 'desc')->first()->id;