示例#1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $superUser = User::firstOrCreate(['first_name' => 'SUPER', 'last_name' => 'ADMIN', 'email' => '*****@*****.**']);
     $superUser->update(['password' => bcrypt('secret')]);
     $adminRole = Role::whereName('SUPER')->first();
     UserRole::firstOrCreate(['user_id' => $superUser->id, 'role_id' => $adminRole->id]);
     factory(User::class, 100)->create()->each(function ($user) {
         //$user->posts()->save(factory(App\Post::class)->make());
     });
 }
示例#2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Requests\CreateRequest $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\CreateRequest $request)
 {
     $role = $this->role->create($request->all());
     return response()->json($role);
 }
示例#3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Role\Role::firstOrCreate(['name' => 'SUPER']);
     Role\Role::firstOrCreate(['name' => 'ADMIN']);
     Role\Role::firstOrCreate(['name' => 'EDITOR']);
 }