Пример #1
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Bima::create([]);
     }
 }
 /**
  * Store a newly created resource in storage.
  * POST /transactions
  *
  * @return Response
  */
 public function store($id)
 {
     $visit = $this->getVisit($id);
     if (!isset($visit) || $visit->done != 0) {
         return Redirect::back()->with('global', 'Bill already settled or No Pending Bills!');
     }
     $data = ['patient_id' => $id, 'visit_id' => $visit->id, 'total' => $this->getTotal($id), 'payment_mode' => Input::get('payment_mode')];
     $validator = Validator::make($data, Transaction::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     }
     if ($trans = Transaction::create($data)) {
         $bima = Bima::where('company', '=', $trans->payment_mode)->where('medical_insurance', '=', $this->getPatient($id)->medical_insurance)->first();
         if ($bima) {
             $bima_balance = $bima->balance;
             if ($bima_balance < 0 && $bima_balance < $trans['total']) {
                 return Redirect::back()->with('global', 'You have an insufficient account to make this transaction!');
             } else {
                 $balance = $bima_balance - $trans['total'];
                 $bima->balance = $balance;
                 $bima->save();
             }
         }
         $visit = $this->getVisit($id);
         $visit->done = 1;
         $visit->save();
         return Redirect::route('transaction-create-get')->with('global', 'Bill successfully settled with ' . $trans->payment_mode);
     }
     return Redirect::route('transaction-create-get')->with('global', 'Error, please try again!');
 }
Пример #3
0
*/
/**
 * Register route bindings
 * FYI - Should be done in the service providers
 */
// Start a new visit
Route::bind('patient', function ($value, $route) {
    return $patient = Patient::find($value);
});
// Destroy a billing item
Route::bind('billing', function ($value, $route) {
    return Billing::where('id', $value)->first();
});
// Destroy a client
Route::bind('bima', function ($value, $route) {
    return Bima::find($value);
});
/**
 * Homepage
 */
Route::get('/', array('as' => 'home', 'uses' => 'HomeController@home'));
/**
 * Authenticated Users
 */
Route::group(array('before' => 'auth'), function () {
    /**
     * CSRF protection group
     */
    Route::group(array('before' => 'csrf'), function () {
        /**
         * Create new staff account (POST)
Пример #4
0
 /**
  * Authenticate a user
  * 
  * @return response
  */
 public function postLogin()
 {
     $validator = Validator::make(Input::all(), array('email' => 'required|email', 'password' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('account-log-in')->withErrors($validator)->withInput();
     } else {
         try {
             $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
             $user = Sentry::authenticate($credentials, false);
             if ($user) {
                 $userGroup = Sentry::findGroupByName('User');
                 if ($user->inGroup($userGroup)) {
                     $bima = Bima::select('id')->where('medical_insurance', '=', $user->membership_no)->first();
                     return Redirect::route('client-get', $bima->id);
                 } else {
                     return Redirect::route('health');
                 }
             }
         } catch (\Exception $e) {
             return Redirect::route('account-log-in')->with('error', $e->getMessage());
         }
     }
 }
Пример #5
0
 /**
  * Remove the specified bima from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Bima $bima)
 {
     Bima::destroy($bima->id);
     return Redirect::route('bimas-get')->with('global', 'Client Deleted Successfully');
 }