Commit 2436901f authored by Micheal Mand's avatar Micheal Mand Committed by Nicolas Widart

Use PSR-2 for Workshop stubs (#244)

Signed-off-by: 's avatarMicheal Mand <micheal@kmdwebdesigns.com>
parent 014b5383
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Modules\$MODULE_NAME$\Http\Controllers\Admin; namespace Modules\$MODULE_NAME$\Http\Controllers\Admin;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\$MODULE_NAME$\Entities\$CLASS_NAME$; use Modules\$MODULE_NAME$\Entities\$CLASS_NAME$;
use Modules\$MODULE_NAME$\Repositories\$CLASS_NAME$Repository; use Modules\$MODULE_NAME$\Repositories\$CLASS_NAME$Repository;
use Modules\Core\Http\Controllers\Admin\AdminBaseController; use Modules\Core\Http\Controllers\Admin\AdminBaseController;
......
...@@ -5,28 +5,28 @@ use Illuminate\Database\Migrations\Migration; ...@@ -5,28 +5,28 @@ use Illuminate\Database\Migrations\Migration;
class Create$MODULE_NAME$$PLURAL_CLASS_NAME$Table extends Migration class Create$MODULE_NAME$$PLURAL_CLASS_NAME$Table extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
* *
* @return void * @return void
*/ */
public function up() public function up()
{ {
Schema::create('$LOWERCASE_MODULE_NAME$__$PLURAL_LOWERCASE_CLASS_NAME$', function(Blueprint $table) { Schema::create('$LOWERCASE_MODULE_NAME$__$PLURAL_LOWERCASE_CLASS_NAME$', function (Blueprint $table) {
$table->engine = 'InnoDB'; $table->engine = 'InnoDB';
$table->increments('id'); $table->increments('id');
// Your fields // Your fields
$table->timestamps(); $table->timestamps();
}); });
} }
/** /**
* Reverse the migrations. * Reverse the migrations.
* *
* @return void * @return void
*/ */
public function down() public function down()
{ {
Schema::drop('$LOWERCASE_MODULE_NAME$__$PLURAL_LOWERCASE_CLASS_NAME$'); Schema::dropIfExists('$LOWERCASE_MODULE_NAME$__$PLURAL_LOWERCASE_CLASS_NAME$');
} }
} }
...@@ -5,15 +5,15 @@ use Illuminate\Database\Migrations\Migration; ...@@ -5,15 +5,15 @@ use Illuminate\Database\Migrations\Migration;
class Create$MODULE_NAME$$CLASS_NAME$TranslationsTable extends Migration class Create$MODULE_NAME$$CLASS_NAME$TranslationsTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
* *
* @return void * @return void
*/ */
public function up() public function up()
{ {
Schema::create('$LOWERCASE_MODULE_NAME$__$LOWERCASE_CLASS_NAME$_translations', function(Blueprint $table) { Schema::create('$LOWERCASE_MODULE_NAME$__$LOWERCASE_CLASS_NAME$_translations', function (Blueprint $table) {
$table->engine = 'InnoDB'; $table->engine = 'InnoDB';
$table->increments('id'); $table->increments('id');
// Your translatable fields // Your translatable fields
...@@ -21,16 +21,19 @@ class Create$MODULE_NAME$$CLASS_NAME$TranslationsTable extends Migration ...@@ -21,16 +21,19 @@ class Create$MODULE_NAME$$CLASS_NAME$TranslationsTable extends Migration
$table->string('locale')->index(); $table->string('locale')->index();
$table->unique(['$LOWERCASE_CLASS_NAME$_id', 'locale']); $table->unique(['$LOWERCASE_CLASS_NAME$_id', 'locale']);
$table->foreign('$LOWERCASE_CLASS_NAME$_id')->references('id')->on('$LOWERCASE_MODULE_NAME$__$PLURAL_LOWERCASE_CLASS_NAME$')->onDelete('cascade'); $table->foreign('$LOWERCASE_CLASS_NAME$_id')->references('id')->on('$LOWERCASE_MODULE_NAME$__$PLURAL_LOWERCASE_CLASS_NAME$')->onDelete('cascade');
}); });
} }
/** /**
* Reverse the migrations. * Reverse the migrations.
* *
* @return void * @return void
*/ */
public function down() public function down()
{ {
Schema::drop('$LOWERCASE_MODULE_NAME$__$LOWERCASE_CLASS_NAME$_translations'); Schema::table('$LOWERCASE_MODULE_NAME$__$LOWERCASE_CLASS_NAME$_translations', function (Blueprint $table) {
} $table->dropForeign(['$LOWERCASE_CLASS_NAME$_id']);
});
Schema::dropIfExists('$LOWERCASE_MODULE_NAME$__$LOWERCASE_CLASS_NAME$_translations');
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment