コード例 #1
0
ファイル: Module.php プロジェクト: Golars/Naissance_Laravel
 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;
 }
コード例 #2
0
 /**
  * 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]);
 }