Posts by Antonio Carlos Ribeiro • 321 points
4 posts
-
2
votes1
answer530
viewsA: Making exceptions in the Eloquent ORM Observers
If you are using namespaces, you may need to inform PHP that your exception is not in the current namespace, but in the root: catch (\Exception $e)
-
6
votes3
answers8261
viewsA: How to recover the ID of the last record inserted in the bank?
If you use Eloquent, this is done automatically regardless of the database system: class Post extends Eloquent { } $post = Post::create(['title' => 'Laravel']); echo $post->id;…
-
10
votes3
answers4468
viewsA: Best(s) way(s) to use Dependency injection in Laravel
Laravel came to make us write simple, objective and uncomplicated code. In the books cited by Daniel, of which the second I am the translator, you will see the first form: public function…
-
4
votes3
answers5592
viewsA: Where to create a class of its own, and how to instantiate it later?
For code directly related to the business rules of your application I’m sorry to say that the PSR-0 is being substituído by PSR-4, which makes our life much easier when it comes to managing class…