/**
  * Extract the thumbnail
  *
  * @param $thumbnail
  * @param User $user
  */
 public function extractThumbnail($thumbnail, User $user)
 {
     $path = public_path() . '/content/profile_pictures/' . $user->id;
     if (!File::exists($path)) {
         File::makeDirectory($path, 0755, true);
     }
     $thumbnailName = time() . '-' . $thumbnail->getClientOriginalName();
     $thumbnail->move($path, $thumbnailName);
     $user->thumbnail = $thumbnailName;
     $user->save();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->truncate();
     //admin
     User::create(['name' => 'Elvin', 'last_name' => 'Makhmudov', 'email' => '*****@*****.**', 'is_admin' => true, 'password' => bcrypt('password')]);
     //dummy user
     User::create(['name' => 'John', 'last_name' => 'Doe', 'email' => '*****@*****.**', 'password' => bcrypt('password')]);
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return User::create(['name' => $data['name'], 'last_name' => $data['last_name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $user = User::findOrFail($id);
     $user->delete();
     return redirect()->route('users.index');
 }