Answer the question
In order to leave comments, you need to log in
What is the best way to work with Eloquent - through the creation of a model or through a container, using an example?
I work for Slim. Connected Eloquent. I look at examples of how people work using the known ORM. Some access the database through the container, others through the model
//all products
$products = $this->container->db->table('products')->get();
foreach ($products as $product){
echo $product->name . "</br>";
}
$products = Product::all();
foreach ($products as $product){
echo $product->name . "</br>";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question