コード例 #1
0
ファイル: Message.php プロジェクト: hramose/material-admin
 public static function getUsers()
 {
     $users = User::all();
     $options = [];
     foreach ($users as $key => $user) {
         $options[$user->id] = $user->name;
     }
     return $options;
 }
コード例 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $administrator = PermissionGroup::create(['name' => 'Administrator']);
     User::create(['email' => '*****@*****.**', 'password' => \Hash::make('12345678'), 'name' => 'Admin', 'surname' => 'Test', 'permission_group_id' => $administrator->id, 'dob' => '1990-11-11', 'language' => 'pt-BR']);
     User::create(['email' => '*****@*****.**', 'password' => \Hash::make('12345678'), 'name' => 'Admin', 'surname' => 'Test', 'permission_group_id' => $administrator->id, 'dob' => '1990-11-11', 'language' => 'pt-BR']);
     User::create(['email' => '*****@*****.**', 'password' => \Hash::make('12345678'), 'name' => 'Admin', 'surname' => 'Test', 'permission_group_id' => $administrator->id, 'dob' => '1990-11-11', 'language' => 'pt-BR']);
     User::create(['email' => '*****@*****.**', 'password' => \Hash::make('12345678'), 'name' => 'Admin', 'surname' => 'Test', 'permission_group_id' => $administrator->id, 'dob' => '1990-11-11', 'language' => 'pt-BR']);
     User::create(['email' => '*****@*****.**', 'password' => \Hash::make('12345678'), 'name' => 'Admin', 'surname' => 'Test', 'permission_group_id' => $administrator->id, 'dob' => '1990-11-11', 'language' => 'pt-BR']);
     /* Create all rules and assign all to administrator rules */
     foreach (\Config::get('admin.roles') as $role_name) {
         $role = Role::create(['name' => $role_name]);
         $administrator->roles()->attach($role->id);
     }
 }
コード例 #3
0
 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     // Load routes if app is not caching routes.
     if (!$this->app->routesAreCached()) {
         require __DIR__ . '/Http/routes.php';
     }
     require_once __DIR__ . '/helpers.php';
     // Publish migrations
     $this->publishes([__DIR__ . '/Database/migrations/' => base_path('/database/migrations')], 'migrations');
     // Publish seeds
     $this->publishes([__DIR__ . '/Database/seeds/' => base_path('/database/seeds')], 'seeds');
     // Publish assets
     $this->publishes([__DIR__ . '/../Assets' => public_path('iget-master/material-admin')], 'public');
     $this->loadViewsFrom(__DIR__ . '/Views', 'materialadmin');
     $this->loadTranslationsFrom(__DIR__ . '/../lang', 'materialadmin');
     User::observe(new UserObserver());
 }
コード例 #4
0
 /**
  * get the image of the user from Storage
  *
  * @param  int  $id
  * @return Response
  */
 public function getUserImage($id)
 {
     $user = User::findOrFail($id);
     $image = storage_path('uploads/user/' . $user->img_url);
     if ($user->img_url && file_exists($image)) {
         return response()->download($image, null, ['Cache-Control' => 'no-cache', 'Pragma' => 'no-cache'], 'inline');
     } else {
         return redirect("/iget-master/material-admin/imgs/user-image.jpg");
     }
 }
コード例 #5
0
 /**
  * get the image of the user from Storage
  *
  * @param  int  $id
  * @return Response
  */
 public function getUserImage($id)
 {
     $image = User::findOrFail($id)->img_url;
     return response()->download(base_path($image), null, ['Chache-Control' => 'no-cache', 'Pragma' => 'no-cache'], 'inline');
 }