Beispiel #1
0
 /**
  * @return $this
  */
 public function home()
 {
     if (Confide::User()) {
         $this->dsp->content = Confide::user()->getContent();
     }
     return View::make('dispatch')->with(['dsp' => $this->dsp]);
 }
 /**
  * Update the specified pet in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $pet = Pet::findOrFail($id);
     $data = Input::all();
     $data['user_id'] = Confide::user()->id;
     $validator = Validator::make($data, Pet::$rules);
     $response = [];
     $response['data'] = $data;
     if ($validator->fails()) {
         $response['success'] = false;
         $response['errors'] = $validator->errors();
         if (Request::ajax()) {
             return Response::json($response);
         } else {
             return Redirect::back()->withErrors($validator->errors());
         }
     }
     $pet->update($data);
     $response['success'] = true;
     $response['errors'] = [];
     if (Request::ajax()) {
         return Response::json($response);
     } else {
         return Redirect::action('UsersController@showProfile', Confide::user()->id);
     }
 }
 /**
  * Displays the login form
  *
  * @return  Illuminate\Http\Response
  */
 public function login()
 {
     if (Confide::user()) {
         return Redirect::to('/');
     } else {
         return View::make(Config::get('confide::login_form'));
     }
 }
 /**
  * Displays the login form
  *
  * @return  Illuminate\Http\Response
  */
 public function login()
 {
     if (Confide::user()) {
         return Redirect::to('/home');
     } else {
         return View::make('site.user.login');
     }
 }
Beispiel #5
0
 /**
  * @param $club_id
  * @return bool
  */
 public static function isExist($club_id)
 {
     $count = DB::table('userclubs')->where('user_id', '=', Confide::user()->id)->where('club_id', '=', $club_id)->count();
     if ($count == 0) {
         return false;
     }
     return true;
 }
 /**
  * Displays the login form
  *
  * @return  Illuminate\Http\Response
  */
 public function login()
 {
     if (Confide::user()) {
         return Redirect::route('backend.challenges.index');
     } else {
         return View::make(Config::get('confide::login_form'));
     }
 }
 /**
  * Displays the login form
  *
  * @return  Illuminate\Http\Response
  */
 public function login()
 {
     if (Confide::user()) {
         return Redirect::to('/store');
     } else {
         return View::make('store.login');
     }
 }
Beispiel #8
0
 /**
  * Provide an array of strings that map to valid roles.
  * @param array $roles
  * @return stdClass
  */
 public function validateRoles(array $roles)
 {
     $user = Confide::user();
     $roleValidation = new stdClass();
     foreach ($roles as $role) {
         $roleValidation->{$role} = empty($user) ? false : $user->hasRole($role);
     }
     return $roleValidation;
 }
 public function getIndex()
 {
     $user = Confide::user();
     if (!$user->isStaff() && Patient::find($user->id) == null) {
         return Redirect::route('patient.create');
     } else {
         return View::make('home/index', compact('user'));
     }
 }
 /**
  * Displays the login form
  *
  * @return  Illuminate\Http\Response
  */
 public function login()
 {
     SEOMeta::setTitle(Lang::get("tags.login"));
     if (Confide::user()) {
         return Redirect::to('/');
     } else {
         return View::make(Config::get('confide::login_form'));
     }
 }
 /**
  * Displays the login form
  *
  * @return  Illuminate\Http\Response
  */
 public function login()
 {
     if (Confide::user()) {
         return Redirect::to('/');
     } else {
         $title = 'League Together - Login';
         return View::make('app.default.login')->with('page_title', $title);
         //return View::make(Config::get('confide::login_form'));
     }
 }
 public function uploadUserImage()
 {
     $user = Confide::user();
     $user->img_path = $this->getAndMoveFile('file');
     if ($user->save()) {
         return Redirect::action('UsersController@show', $user->id);
     } else {
         throw new Exception("user image not updated!");
     }
 }
Beispiel #13
0
 /**
  * Displays the login form
  *
  */
 public function login()
 {
     if (\Confide::user()) {
         // If user is logged, redirect to internal
         // page, change it to '/admin', '/dashboard' or something
         return Redirect::to('/');
     } else {
         $this->renderPage(array("content_view" => Config::get('confide::login_form')));
     }
 }
 public function showAll()
 {
     $user = Confide::user();
     $patients = Patient::join('user', 'user.id', '=', 'patient.user_id')->get();
     if ($user->isStaff()) {
         return View::make('home.patient.show-all', compact('user', 'patients'));
     } else {
         return Redirect::route('home.index');
     }
 }
 public function createComment($conversation)
 {
     $user = Confide::user();
     $comment = new Comment();
     $comment->conversation_id = $conversation->id;
     $comment->user_id = $user->id;
     $comment->fill(Input::all());
     $comment->save();
     return Redirect::route('conversation.show', array($conversation->id));
 }
Beispiel #16
0
 public static function logAudit($entity, $action, $description)
 {
     $audit = new Audit();
     $audit->date = date('Y-m-d');
     $audit->description = $description;
     $audit->user = Confide::user()->username;
     $audit->entity = $entity;
     $audit->action = $action;
     $audit->save();
 }
 /**
  * Displays the login form
  *
  */
 public function login()
 {
     if (Confide::user()) {
         // If user is logged, redirect to internal
         // page, change it to '/admin', '/dashboard' or something
         return Redirect::to('/home');
     } else {
         return View::make(Config::get('confide::login_form'));
     }
 }
 /**
  * Display a listing of notifications
  *
  * @return Response
  */
 public function index()
 {
     $data = Input::all();
     $pagination = Input::has('pagination') ? Input::get('pagination') : 10;
     // FILTRA RESULTADOS
     $notifications = Notification::where(function ($query) {
         switch (Input::get('view')) {
             case 'next':
                 // AGENDADAS
                 $query->where('date', '>', date('Y-m-d H:i:s'));
                 break;
             case 'all':
                 // $query->where( 'user_id', Confide::user()->id );
                 break;
             default:
                 // NÃO LIDAS
                 $query->where('date', '<', date('Y-m-d H:i:s'))->where('status', 0);
                 break;
         }
         if (Input::has('type')) {
             $query->where('type', Input::get('type'));
         }
         if (Input::has('owner_type')) {
             $query->where('owner_type', Input::get('owner_type'));
         }
         if (Input::has('owner_id')) {
             $query->where('owner_id', Input::get('owner_id'));
         }
         if (Input::has('order')) {
             $query->orderBy('date', Input::get('order'));
         }
     })->where('user_id', Confide::user()->id)->orderBy('date', Input::get('order', 'DESC'))->paginate($pagination);
     switch (Input::get('view', 'unread')) {
         case 'next':
             $labels['nothing'] = 'Nenhuma notificação agendada';
             break;
         case 'all':
             $labels['nothing'] = 'Nenhuma notificação ainda';
             break;
         default:
             // case 'unread'
             $labels['nothing'] = 'Nenhuma notificação não lida';
             break;
     }
     $labels['count_next'] = Notification::where('user_id', Confide::user()->id)->where('date', '>', date('Y-m-d H:i:s'))->count();
     $labels['count_all'] = Notification::where('user_id', Confide::user()->id)->count();
     $labels['count_unread'] = Notification::where('user_id', Confide::user()->id)->where('date', '<', date('Y-m-d H:i:s'))->where('status', false)->count();
     //$notifications->getCollection()->paginate( $pagination );//->paginate( $pagination ;
     if (Request::ajax()) {
         return View::make('notifications.panels.index', compact('notifications', 'labels'));
     } else {
         return View::make('notifications.index', compact('notifications', 'labels'));
     }
 }
Beispiel #19
0
 /**
  * @param string $backUrl
  * @param int $club_id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function add($backUrl = 'home', $club_id = 0)
 {
     if ($club_id == 0) {
         return Redirect::route($backUrl);
     }
     $userclub = new Userclub();
     $userclub->user_id = Confide::user()->id;
     $userclub->club_id = $club_id;
     $userclub->save();
     return Redirect::route($backUrl);
 }
Beispiel #20
0
 public function getBalance($wallet_id)
 {
     $balance = 0;
     if (!Auth::guest()) {
         $user = Confide::user();
         $balanceCoin = Balance::where('user_id', '=', $user->id)->where('wallet_id', '=', $wallet_id)->first();
         if (isset($balanceCoin->amount)) {
             $balance = $balanceCoin->amount;
         }
     }
     return $balance;
 }
Beispiel #21
0
 public function getCurrentOrdersUser($market_id, $user_id = '')
 {
     if (Auth::guest()) {
         return false;
     }
     $user = Confide::user();
     if ($user_id == '') {
         $user_id = $user->id;
     }
     $orders = Order::where('market_id', '=', $market_id)->where('user_id', '=', $user_id)->whereIn('status', $this->status_active)->orderBy('created_at', 'desc')->get();
     return $orders;
 }
Beispiel #22
0
 /**
  * @return string
  */
 public function beforeHome()
 {
     // Extend function home()
     if (!Confide::user()->isManager()) {
         return $this->dsp->content = $this->directory . ".nomanager";
     } else {
         if (!Confide::user()->isDomaine()) {
             return $this->dsp->content = $this->directory . ".nodomaine";
         }
     }
     // Sinon procedure Home normale
 }
 /**
  * Displays the login form
  *
  */
 public function login()
 {
     if (Confide::user()) {
         // If user is logged, redirect to internal
         // page, change it to '/admin', '/dashboard' or something
         return Redirect::to('/');
     } else {
         if (Input::has('next')) {
             Session::put('next_url', Input::get('next'));
         }
         return View::make(Config::get('confide::login_form'));
     }
 }
 /**
  * Attempt to do login
  *
  * @return  Illuminate\Http\Response
  */
 public function doLogin()
 {
     $repo = App::make('UserRepository');
     $input = Input::all();
     if ($repo->login($input)) {
         return Redirect::action('UsersController@showProfile', Confide::user()->id);
     } else {
         if ($repo->isThrottled($input)) {
             $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
         } elseif ($repo->existsButNotConfirmed($input)) {
             $err_msg = Lang::get('confide::confide.alerts.not_confirmed');
         } else {
             $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
         }
         return Redirect::action('UsersController@login')->withInput(Input::except('password'))->with('error', $err_msg);
     }
 }
Beispiel #25
0
 public static function submitApplication($data)
 {
     $member_id = array_get($data, 'member_id');
     $loanproduct_id = array_get($data, 'loanproduct_id');
     $member = Member::findorfail($member_id);
     $loanproduct = Loanproduct::findorfail($loanproduct_id);
     $application = new Loanaccount();
     $application->member()->associate($member);
     $application->loanproduct()->associate($loanproduct);
     $application->application_date = array_get($data, 'application_date');
     $application->amount_applied = array_get($data, 'amount_applied');
     $application->interest_rate = $loanproduct->interest_rate;
     $application->period = $loanproduct->period;
     $application->repayment_duration = array_get($data, 'repayment_duration');
     $application->save();
     Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'loan application', 'Loans', array_get($data, 'amount_applied'));
 }
 /**
  * Store a newly created savingtransaction in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Savingtransaction::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $date = Input::get('date');
     $transAmount = Input::get('amount');
     $savingaccount = Savingaccount::findOrFail(Input::get('account_id'));
     $savingtransaction = new Savingtransaction();
     $savingtransaction->date = Input::get('date');
     $savingtransaction->savingaccount()->associate($savingaccount);
     $savingtransaction->amount = Input::get('amount');
     $savingtransaction->type = Input::get('type');
     $savingtransaction->description = Input::get('description');
     $savingtransaction->transacted_by = Input::get('transacted_by');
     $savingtransaction->save();
     // withdrawal
     if (Input::get('type') == 'debit') {
         foreach ($savingaccount->savingproduct->savingpostings as $posting) {
             if ($posting->transaction == 'withdrawal') {
                 $debit_account = $posting->debit_account;
                 $credit_account = $posting->credit_account;
             }
         }
         $data = array('credit_account' => $credit_account, 'debit_account' => $debit_account, 'date' => Input::get('date'), 'amount' => Input::get('amount'), 'initiated_by' => 'system', 'description' => 'cash withdrawal');
         $journal = new Journal();
         $journal->journal_entry($data);
         Savingtransaction::withdrawalCharges($savingaccount, $date, $transAmount);
         Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'savings withdrawal', 'Savings', Input::get('amount'));
     }
     // deposit
     if (Input::get('type') == 'credit') {
         foreach ($savingaccount->savingproduct->savingpostings as $posting) {
             if ($posting->transaction == 'deposit') {
                 $debit_account = $posting->debit_account;
                 $credit_account = $posting->credit_account;
             }
         }
         $data = array('credit_account' => $credit_account, 'debit_account' => $debit_account, 'date' => Input::get('date'), 'amount' => Input::get('amount'), 'initiated_by' => 'system', 'description' => 'cash deposit');
         $journal = new Journal();
         $journal->journal_entry($data);
         Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'savings deposit', 'Savings', Input::get('amount'));
     }
     return Redirect::to('savingtransactions/show/' . $savingaccount->id);
 }
 public function showAll($requestID = null)
 {
     $user = Confide::user();
     $patient = Patient::find($requestID);
     $patient = Patient::join('user', 'user.id', '=', 'patient.user_id')->where('patient.user_id', '=', $user->id)->first();
     if ($user->isStaff() && $requestID !== null) {
         // If weare requesting a patient's appointments and we are Staff
         $appointments = Appointment::where('patient_id', '=', $requestID)->get();
         $patient = Patient::join('user', 'user.id', '=', 'patient.user_id')->where('patient.user_id', '=', $requestID)->first();
     } else {
         $appointments = Appointment::where('patient_id', '=', $user->id)->get();
     }
     foreach ($appointments as $appointment) {
         $doctor = User::find($appointment->staff_id);
         $appointment->doctor = $doctor->first_name . ' ' . $doctor->last_name;
     }
     return View::make('home/appointment/show-all', compact('user', 'appointments', 'patient'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $validator = Validator::make($data, Post::$rules);
     if ($validator->fails()) {
         Session::flash('message', 'Posting not created!');
         return Redirect::back()->withInput()->withErrors($validator);
     }
     $post = new Post($data);
     $post->user_id = Confide::user()->id;
     $result = $post->save();
     if ($result) {
         return Redirect::action('PostsController@index');
     } else {
         Session::flash('message', $result);
         return Redirect::back()->withInput();
     }
 }
Beispiel #29
0
 /**
  * Store a newly created branch in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Appraisal::$rules, Appraisal::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $appraisal = new Appraisal();
     $appraisal->employee_id = Input::get('employee_id');
     $appraisal->appraisalquestion_id = Input::get('appraisal_id');
     $appraisal->performance = Input::get('performance');
     $appraisal->rate = Input::get('score');
     $appraisal->examiner = Confide::user()->id;
     $appraisal->appraisaldate = Input::get('date');
     $appraisal->comment = Input::get('comment');
     $appraisal->save();
     Audit::logaudit('Employee Appraisal', 'create', 'created: ' . $appraisal->question);
     return Redirect::route('Appraisals.index')->withFlashMessage('Employee Appraisal successfully created!');
 }
Beispiel #30
0
 public static function submit($data)
 {
     //$charges = Input::get('charge');
     $loanproduct = new Loanproduct();
     $loanproduct->name = array_get($data, 'name');
     $loanproduct->short_name = array_get($data, 'short_name');
     $loanproduct->interest_rate = array_get($data, 'interest_rate');
     $loanproduct->formula = array_get($data, 'formula');
     $loanproduct->amortization = array_get($data, 'amortization');
     $loanproduct->currency = array_get($data, 'currency');
     $loanproduct->save();
     Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'loan product creation', 'Loans', '0');
     $loan_id = $loanproduct->id;
     Loanposting::submit($loan_id, $data);
     /*
     		foreach($charges as $charge){
     	$loanproduct->charges()->attach($charge);
     		}
     */
 }