public function getAll($where = array(), $limit = self::MAX_LIMIT, $offset = 0) { $query = Model::query(); foreach ($where as $key => $value) { if (!is_array($value)) { $query->where($key, '=', $value); } else { $query->whereIn($key, $value); } } $collection = $query->orderBy('created_at', 'desc')->take($limit)->skip($offset)->get(); return $collection; }
/** * Run the migrations. * * @return void */ public function up() { Schema::dropIfExists('modules'); Schema::create('modules', function (Blueprint $table) { $table->increments("id"); $table->string("name")->unique(); $table->string('info'); $table->string('version')->default(0); $table->string('install_version')->default(0); $table->tinyInteger('status')->unsigned()->default(0); $table->timestamps(); }); Module::create(['name' => 'VergoBase', 'info' => 'Is a base Vergo Model with User Roles and Modules skillet', 'version' => 1, 'install_version' => 1, 'status' => 1]); }