funcion/refactor-general #45

Open
atasistro wants to merge 111 commits from funcion/refactor-general into master
2 changed files with 51 additions and 0 deletions
Showing only changes of commit bed975e944 - Show all commits

10
app/UserRole.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class UserRole extends Model
{
protected $fillable = ["nombre"];
}

View file

@ -0,0 +1,41 @@
<?php
use App\UserRole;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateUserRolesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_roles', function (Blueprint $table) {
$table->id();
$table->string('nombre');
$table->timestamps();
});
$tipos = ["barrio", "admin_barrio", "comision"];
foreach ($tipos as $tipo) {
UserRole::create([
"nombre" => $tipo,
]);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_roles');
}
}