コード例 #1
0
ファイル: BillController.php プロジェクト: bll44/billcalc
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $http)
 {
     // if($http->filter === '')
     $resident = Resident::find(Auth::user()->id);
     $bills = $resident->bills;
     return view('bills.index', compact('bills'));
 }
コード例 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     date_default_timezone_set('UTC');
     $blatsha = Resident::where('username', 'blatsha')->first();
     $testuser000 = Resident::where('username', 'testuser000')->first();
     $testuser001 = Resident::where('username', 'testuser001')->first();
     $now = date('Y-m-d H:i:s');
     DB::table('residence_resident')->insert([['resident_id' => $blatsha->id, 'residence_id' => 1, 'created_at' => $now, 'updated_at' => $now], ['resident_id' => $blatsha->id, 'residence_id' => 2, 'created_at' => $now, 'updated_at' => $now], ['resident_id' => $testuser000->id, 'residence_id' => 1, 'created_at' => $now, 'updated_at' => $now], ['resident_id' => $testuser001->id, 'residence_id' => 1, 'created_at' => $now, 'updated_at' => $now]]);
 }
コード例 #3
0
 public function postAddResident(Request $http)
 {
     $resident = Resident::find($http->resident_id);
     $residence = Residence::find($http->residence_id);
     $query = 'select * from calcdb.residence_resident where resident_id = ? and residence_id = ?';
     $statement = DB::select($query, array($resident->id, $residence->id));
     // Create relationship between residence and newly added resident
     $residence->residents()->attach($resident->id);
     return response()->json(['status' => 200, 'query' => $query]);
 }
コード例 #4
0
ファイル: BillsTableSeeder.php プロジェクト: bll44/billcalc
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // set default timezone for date() functions to UTC
     date_default_timezone_set('UTC');
     $now = date('Y-m-d H:i:s');
     // the current day and time
     $last_day_of_month = '2016-02-04 00:00:01';
     $blatsha = Resident::where('username', 'blatsha')->first();
     $N12thSt = Residence::where('nickname', 'Lucky Garden Gambling Place')->first();
     DB::table('bills')->insert([['resident_id' => $blatsha->id, 'residence_id' => $N12thSt->id, 'name' => 'Verizon bill', 'amount' => null, 'due_date' => $last_day_of_month, 'description' => 'Verizon bill for cable and internet', 'active' => 0], ['resident_id' => $blatsha->id, 'residence_id' => $N12thSt->id, 'name' => 'Gas bill', 'amount' => null, 'due_date' => $last_day_of_month, 'description' => 'PGW gas bill', 'active' => 0]]);
 }
コード例 #5
0
 /**
  * Verify the unit_number and identity provided
  *
  * @param VerifyResidentRequest $request
  * @return string The resident id.
  * The resident id.
  */
 public function verify(VerifyResidentRequest $request)
 {
     $return = array('found' => false, 'resident_id' => null, 'errors' => '');
     $result = Resident::where(['unit_number' => $request->unit_number, 'identity' => $request->identity])->first();
     if (isset($result)) {
         $return['found'] = true;
         $return['resident_id'] = $result->id;
     } else {
         $return['errors'] = '对不起,没有找到该住户信息,请重新输入。';
     }
     return $return;
 }
コード例 #6
0
ファイル: routes.php プロジェクト: JohanArmando/ProyectoGrado
Route::post('entrar', ['as' => 'entrar', 'uses' => 'LogController@postLogin']);
Route::get('logout', ['as' => 'logout', 'uses' => 'LogController@logout']);
/*Routes Residente*/
Route::group(['namespace' => 'Resident', 'prefix' => 'resident', 'middleware' => ['auth']], function () {
    Route::get('home', ['as' => 'home', 'uses' => 'HomeController@getHome']);
    Route::post('proyecto/avance', ['as' => 'residente.proyecto.avance', 'uses' => 'AvanceController@avanceProyecto']);
    Route::post('proyecto/avance/add', ['as' => 'residente.avance.add', 'uses' => 'AvanceController@addAvance']);
    Route::get('last/advanced', ['as' => 'residente.avance.last', 'uses' => 'AvanceController@last']);
    Route::get('users', ['as' => 'residente.users', 'uses' => 'AvanceController@users']);
    Route::get('all', ['as' => 'residente.all', 'uses' => 'AvanceController@all']);
    Route::resource('advanced', 'AvanceController');
});
/*Routes admin*/
Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth', 'admin']], function () {
    Route::get('home', function () {
        $residents = \App\Resident::where('type', '<>', 'admin')->count();
        $projects = \App\Project::count();
        $beneficiaries = \App\Beneficiary::count();
        $disenos = \App\Desing::count();
        return view('admin.home', compact('projects', 'residents', 'beneficiaries', 'disenos'));
    });
    Route::post('delete/stage/project', ['as' => 'detele.staage.project', 'uses' => 'ProjectController@deleteStageProject']);
    Route::get('opciones/proyecto', ['as' => 'option.project', 'uses' => 'ProjectController@opciones']);
    Route::post('etapas/proyecto', ['as' => 'admin.project.stage', 'uses' => 'ProjectController@stageProject']);
    Route::post('all/stage', ['uses' => 'ProjectController@allStage']);
    Route::post('nothing/stage', ['uses' => 'ProjectController@nothingStage']);
    Route::post('etapas/proyecto/dos', ['as' => 'admin.add.stage.project', 'uses' => 'ProjectController@stageProjectAdd']);
    Route::resource('proyectos', 'ProjectController');
    Route::post('benficiarios/cambiar/proyecto/', ['as' => 'admin.beneficiarios.change-project', 'uses' => 'BeneficiarioController@changeProject']);
    Route::get('beneficiario/project/{id}', ['as' => 'admin.project.beneficiario', 'uses' => 'BeneficiarioController@directBen']);
    Route::post('residente/change/project/', ['as' => 'admin.residentes.change-project', 'uses' => 'ResidenteController@changeProject']);
コード例 #7
0
ファイル: Bill.php プロジェクト: bll44/billcalc
 public function getOwner()
 {
     return Resident::find($this->resident_id);
 }
コード例 #8
0
 public function changeProject(Request $request)
 {
     $resident = Resident::find($request->get('residente_id'));
     foreach ($request->get('project_id') as $project) {
         $resident->proyectos()->attach($project);
     }
     Session::flash('message', 'Residente ' . $request->name . ' se le asignaron nuevos proyectos');
     return redirect()->to('admin/residentes');
 }