/**
  * Display a listing of the resource.
  * GET /leavepayadmin
  *
  * @return Response
  */
 public function index()
 {
     $empty = '';
     $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first();
     $getleave = LeaveWPay::with('user')->where('status', $empty)->orderBy('created_at', 'desc')->get();
     return View::make('admindashboard.leavepay')->with('admin', $profile)->with('getleave', $getleave)->with('title', 'STI | Leave Panel with pay');
 }
 /**
  * Display the specified resource.
  * GET /policies/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show()
 {
     $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first();
     $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first();
     $policies = AdminPolicies::orderBy('created_at', 'desc')->get();
     return View::make('dashboard.policies')->with('profile', $profile)->with('policies', $policies)->with('countleave', $leavecount)->with('title', 'STI | School Policies');
 }
 /**
  * Display the specified resource.
  * GET /leavewopay/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $recentleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $getleave = LeaveWOPay::with('user')->where('leave_id', $id)->first();
     $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first();
     $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first();
     return View::make('dashboard.leave_logw')->with('profile', $profile)->with('rleave', $recentleave)->with('getleave', $getleave)->with('countleave', $leavecount)->with('title', 'STI | Leave with pay');
 }
 public function show_announce($id)
 {
     $post_comment = AnnouncementComments::where('post_id', $id)->orderBy('created_at', 'desc')->get();
     $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first();
     $announce = Announcements::with('user')->where('post_id', $id)->orderBy('created_at', 'desc')->first();
     $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first();
     $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     return View::make('dashboard.announcement')->with('post', $announce)->with('post_comment', $post_comment)->with('profile', $profile)->with('countleave', $leavecount)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('title', 'STI | Show Announcement');
 }
 /**
  * Display a listing of the resource.
  * GET /notification
  *
  * @return Response
  */
 public function index()
 {
     $leavelog = UserLeaveLog::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $leaveoblog = LeaveOB::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first();
     $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first();
     $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $obleave = LeaveOB::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $awtleave = LeaveAWT::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     return View::make('dashboard.notification_box')->with('profile', $profile)->with('leavelog', $leavelog)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('leaveob', $leaveoblog)->with('leaveawt', $awtleave)->with('countleave', $leavecount)->with('obleave', $obleave)->with('title', 'STI | Notification Box');
 }
 public function postEdit()
 {
     $pic_New_Name = NULL;
     if (Input::hasFile('pic')) {
         $file = Input::file('pic');
         $new_path = 'assets\\projects\\images\\profilepics';
         $file_Temporary_name = $file->getFilename();
         // emporary file name
         $file_OriginalName = $file->getClientOriginalName();
         // Original Name of the file
         $file_Size = $file->getClientSize();
         // Size of the file
         $file_MimeType = $file->getClientMimeType();
         // Mime Type of the file
         $file_Extension = $file->guessClientExtension();
         // Ext of the file
         $file_TemporaryPath = $file->getRealPath();
         // Temporary file path
         $pic_New_Name = md5(date('Y-m-d H:i:s:u')) . "." . $file_Extension;
         $uploaded = $file->move($new_path, $pic_New_Name);
     }
     //$pic = Image::make($file)->resize(300,150)->save($new_path.$file_OriginalName);
     $validator = Validator::make(Input::all(), array('first_name' => 'max:30', 'last_name' => 'max:30', 'mobile_number' => 'max:10', 'home_number' => 'max:10', 'dd' => 'max:2', 'mm' => 'max:2', 'yyyy' => 'max:4', 'add_1' => 'max:30', 'city' => 'max:30', 'state' => 'max:30', 'pin_code' => 'max:10', 'country' => 'max:30'));
     if ($validator->fails()) {
         return Redirect::route('admin-profile')->withErrors($validator)->withInput();
     } else {
         $user = $this->getUser();
         $user_details = UserDetails::where('user_id', '=', $user->id)->get()->first();
         $now = date("Y-m-d H-i-s");
         $user_details->first_name = Input::get('first_name');
         $user_details->middle_name = Input::get('middle_name');
         $user_details->last_name = Input::get('last_name');
         if ($user_details->mobile_number != Input::get('mobile_number')) {
             $user_details->mobile_number = Input::get('mobile_number');
             $user_details->mobile_updated_at = $now;
         }
         $user_details->home_number = Input::get('home_number');
         $user_details->dob = Input::get('yyyy') . "-" . Input::get('mm') . "-" . Input::get('dd');
         $user_details->sex = Input::get('sex');
         $user_details->marriage_status = Input::get('marriage_status');
         if ($user_details->add_1 != Input::get('add_1') || $user_details->add_2 != Input::get('add_2')) {
             $user_details->add_1 = Input::get('add_1');
             $user_details->add_2 = Input::get('add_2');
             $user_details->address_updated_at = $now;
         }
         if ($user_details->city != Input::get('city') || $user_details->state != Input::get('state') || $user_details->pin_code != Input::get('pin_code') || $user_details->country != Input::get('country')) {
             $user_details->city = Input::get('city');
             $user_details->state = Input::get('state');
             $user_details->pin_code = Input::get('pin_code');
             $user_details->country = Input::get('country');
             $user_details->address_updated_at = $now;
         }
         if (isset($pic_New_Name)) {
             $user_details->pic = $pic_New_Name;
             $user_details->pic_updated_at = $now;
         }
         if ($user_details->save()) {
             return Redirect::route('admin-profile')->with('details-changed', 'Your Details are updated');
         } else {
             return Redirect::route('admin-profile')->with('details-not-changed', 'Your Details Couldnt updated. Some Error Occured');
         }
     }
 }
 public function ob_log($id)
 {
     $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first();
     $leaveob = LeaveOB::where('leave_id', $id)->first();
     $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first();
     $rleave = LeaveOB::where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     return View::make('dashboard.leave_oblog')->with('profile', $profile)->with('countleave', $leavecount)->with('getleave', $leaveob)->with('rleave', $rleave)->with('title', 'STI | OB Log');
 }
 public function update_leave($id)
 {
     $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first();
     $leavecount = LeaveCounter::where('employee_id', $id)->first();
     return View::make('admindashboard.updateleave')->with('profile', $profile)->with('leavecount', $leavecount)->with('title', 'STI | Update Leave Count');
 }
<?php

$user_id = Sentry::getUser()->id;
$user_group = UsersGroups::where('user_id', '=', $user_id)->get()->first();
$userDetails = UserDetails::where('user_id', '=', $user_id)->get()->first();
?>
@section('upper-dropdown')
<a data-toggle="dropdown" data-hover="dropdown" class="dropdown-toggle" data-close-others="true" href="#">
    @if($userDetails->pic == null)
    <img src="{{ URL::asset('assets/projects/images/no_img.png') }}" class="img-circle" alt="" width="30px" height="30px">
    @else
    <img src="{{ URL::asset('assets/projects/images/profilepics/'.$userDetails->pic) }}" class="img-circle" alt="" width="30px" height="30px">
    @endif
    <span class="username hidden-xs">{{ $userDetails->first_name }} {{ $userDetails->last_name }}</span> <i class="fa fa-caret-down "></i>
</a>
@stop
@section('left-user-profile')
<div class="inline-block">
    @if($userDetails->pic == null)
    <img src="{{ URL::asset('assets/projects/images/no_img.png') }}" class="img-circle" alt="" width="50px" height="50px">
    @else
    <img src="{{ URL::asset('assets/projects/images/profilepics/'.$userDetails->pic) }}" alt="" height="50px" width="50px">
    @endif
</div>
<div class="inline-block">
    <h5 class="no-margin"> Welcome </h5>
    <h4 class="no-margin"> {{ $userDetails->first_name }} {{ $userDetails->last_name }} </h4>
</div>
@stop

@section('left-menu')
 public function postSignIn()
 {
     $inputs = array('identity' => Input::get('identity'), 'password' => Input::get('password'));
     //Since user can enter username,email we cannot have email validator
     $rules = array('identity' => 'required|min:4|max:32', 'password' => 'required|min:6');
     //Find is that username or password and change identity validation rules
     //Lets use regular expressions
     if (filter_var(Input::get('identity'), FILTER_VALIDATE_EMAIL)) {
         //It is email
         $rules['identity'] = 'required|min:4|max:32|email';
     } else {
         //It is username . Check if username exist in profile table
         if (UserDetails::where('username', Input::get('identity'))->count() > 0) {
             //User exist so get email address
             $user = UserDetails::where('username', Input::get('identity'))->first();
             $inputs['identity'] = $user->email;
         } else {
             Session::flash('global', 'User does not exist');
             return Redirect::to(route('teacher-sign-in'))->withInput(Input::except('password'));
         }
     }
     $v = Validator::make($inputs, $rules);
     if ($v->fails()) {
         return Redirect::to(route('teacher-sign-in'))->withErrors($v)->withInput(Input::except('password'));
     } else {
         try {
             //Try to authenticate user
             $user = Sentry::getUserProvider()->findByLogin(Input::get('identity'));
             $throttle = Sentry::getThrottleProvider()->findByUserId($user->id);
             $throttle->check();
             //Authenticate user
             $credentials = array('email' => Input::get('identity'), 'password' => Input::get('password'));
             //For now auto activate users
             $user = Sentry::authenticate($credentials, false);
             //At this point we may get many exceptions lets handle all user management and throttle exceptions
         } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
             Session::flash('global', 'Login field is required.');
             return Redirect::to(route('teacher-sign-in'));
         } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
             Session::flash('global', 'Password field is required.');
             return Redirect::to(route('teacher-sign-in'));
         } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
             Session::flash('global', 'Wrong password, try again.');
             return Redirect::to(route('teacher-sign-in'));
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             Session::flash('global', 'User was not found.');
             return Redirect::to(route('teacher-sign-in'));
         } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
             Session::flash('global', 'User is not activated.');
             return Redirect::to(route('teacher-sign-in'));
         } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
             Session::flash('global', 'User is suspended ');
             return Redirect::to(route('teacher-sign-in'));
         } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
             Session::flash('global', 'User is banned.');
             return Redirect::to(route('teacher-sign-in'));
         }
         //    $users_login_info = UsersLoginInfo::where('user_id', '=', $user->id)->get();
         Session::flash('global', 'Loggedin Successfully');
         if ($user->school_id != null && $user->last_login != null) {
             $school_id = $user->school_id;
             $users_login_info = new UsersLoginInfo();
             $users_login_info->user_id = $user->id;
             $users_login_info->school_id = $school_id;
             if ($users_login_info->save()) {
                 Session::flash('global', 'Loggedin Successfully.');
                 return Redirect::to(route('teacher-home'));
             }
         } else {
             return Redirect::to(route('teacher-welcome-settings'));
         }
     }
 }
 public function getUserProfile()
 {
     $user = Sentry::getUser();
     $user_details = UserDetails::where('user_id', '=', $user->id)->get()->first();
     return View::make('user.profile')->withuser($user)->with('user_details', $user_details);
 }
Exemple #12
0
 /**
  * Display a listing of the resource.
  * GET /leavewplog
  *
  * @return Response
  */
 public function index()
 {
     $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first();
     $getleave = AdminLogWP::with('user')->where('status', '!=', '')->orderBy('created_at', 'desc')->get();
     return View::make('admindashboard.wplog.approvelog')->with('admin', $profile)->with('getleave', $getleave)->with('title', 'STI | (With pay) Logs');
 }
 /**
  * Api for Brief Registration
  */
 public function postBriefRegistration()
 {
     $first_name = Input::get('first_name');
     $last_name = Input::get('last_name');
     $sex = Input::get('sex');
     $user_details = UserDetails::where('user_id', '=', Sentry::getUser()->id)->get()->first();
     $user_details->first_name = $first_name;
     $user_details->last_name = $last_name;
     $user_details->sex = $sex;
     if ($user_details->save()) {
         $response = array('status' => 'success', 'result' => array('details' => $user_details));
         return Response::json($response);
     } else {
         $response = array('status' => 'failed', 'result' => array('details' => null));
         return Response::json($response);
     }
 }