Answer the question
In order to leave comments, you need to log in
When is it better to do without a model using the Slim framework and eloquent?
The documentation for Slim in the Eloquent section has an example of using it without creating a model, when we simply get an object from the base in the container, and then pass it to the class we need.
$container[App\WidgetController::class] = function ($c) {
$view = $c->get('view');
$table = $c->get('db')->table('table_name');
return new \App\WidgetController($view, $logger, $table);
};
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $table = 'users';
}
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