Agregada tabla y modelo para roles de usuario
This commit is contained in:
parent
e508e71b81
commit
bed975e944
2 changed files with 51 additions and 0 deletions
10
app/UserRole.php
Normal file
10
app/UserRole.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserRole extends Model
|
||||
{
|
||||
protected $fillable = ["nombre"];
|
||||
}
|
|
@ -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');
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue