/**
  * Handle the command.
  *
  * @param  RegisterNewUserCommand  $command
  * @return void
  */
 public function handle(RegisterNewLeaderUserCommand $command)
 {
     $user = User::registerLeader($command->role_id, $command->name, $command->email, $command->group, $command->password, $command->email_token);
     $this->repo->save($user);
     event(new UserWasRegistered($user));
     return $user;
 }
Ejemplo n.º 2
0
 /**
  * [generatePresenteWhenInitNewDate description]
  * @param  [type] $calendar [description]
  * @param  [type] $month    [description]
  * @param  [type] $year     [description]
  * @return [type]           [description]
  */
 public function generatePresenteWhenInitNewDate($calendar, $month, $year)
 {
     $date = date("j");
     $time = Carbon::create($year, $month, $date, 0, 0, 0);
     $currentTime = Carbon::today();
     if ($time < $currentTime) {
         $date = 31;
     } else {
         if ($time > $currentTime) {
             $date = 1;
         }
     }
     $holidays = Setting::where('name', 'holidays')->first()->value;
     $arrHolidays = json_decode($holidays);
     // Carbon::createFromFormat('d/m/Y',);
     for ($i = 1; $i <= $date; $i++) {
         $dt = Carbon::create($year, $month, $i);
         if ($calendar->{'n' . $i} == "") {
             if ($this->checkExistDateInHoliday($dt->format('d/m/Y'), $arrHolidays)) {
                 $calendar->{'n' . $i} = "HO";
             } else {
                 if ($dt->dayOfWeek == 6 || $dt->dayOfWeek == 0) {
                     $calendar->{'n' . $i} = "W";
                 } else {
                     $calendar->{'n' . $i} = "P";
                 }
             }
         }
     }
     $calendar->save();
 }
Ejemplo n.º 3
0
 /**
  * [resetPassword description]
  * @param  [type] $user     [description]
  * @param  [type] $password [description]
  * @param  [type] $guard    [description]
  * @return [type]           [description]
  */
 protected function resetPassword($user, $password, $guard)
 {
     $user->password = bcrypt($password);
     $user->save();
     if ($user->active == 1) {
         Auth::guard($guard)->login($user);
     }
 }
Ejemplo n.º 4
0
 /**
  * dave image file
  * @param  [type] $path    [description]
  * @param  [type] $quality [description]
  * @return [type]          [description]
  */
 public function save($path = null, $quality = null)
 {
     if ($this->isAnimatedGif) {
         $framesProcessed = array();
         foreach ($this->frames as $frame) {
             $framesProcessed[] = $frame['image'];
         }
         $this->gifCreator->create($framesProcessed, $this->gifFrameExtractor->getFrameDurations(), 0);
         $gifBinary = $this->gifCreator->getGif();
         $this->gifCreator->reset();
         file_put_contents($path, $gifBinary);
     } else {
         $this->imgFileRes->save($path, $quality);
     }
     return $this;
 }
Ejemplo n.º 5
0
    /**
     *
     *  Store the excel file to the server without a download popup
     *
     *  @param str $ext The file extension
     *  @param str $path The save path
     *  @return $this
     *
     */
    public function store($ext = 'xls', $path = false, $returnInfo = false)
    {

        // Set the default path
        if($path == false)
        {
            $path = $this->config->get('excel::path');
        }

        // Trim of slashes, to makes sure we won't add them double.
        $path = rtrim($path, '/');
        //$path = ltrim($path, '/');

        // Set the extension
        $this->ext = $ext;

        // Render the XLS
        $this->render();

        $toStore = $path . '/' . $this->title . '.' . $this->ext;

        // Save the file to specified location
        $this->object->save($toStore);


        if($returnInfo)
        {

            // Send back information about the stored file
            return array(
                'full'  => $toStore,
                'path'  => $path,
                'file'  => $this->title . '.' . $this->ext,
                'title' => $this->title,
                'ext'   => $this->ext
            );

        }

        return $this;

    }
 /**
  * update account
  * 
  * @param  [type] $user 
  * @return [type]       
  */
 public function updateAccountToVerified($user)
 {
     $user->is_verified = true;
     $user->email_token = null;
     $user->save();
 }