示例#1
0
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 30) as $index) {
         Sector::create(['sector_name' => $faker->domainWord]);
         $this->command->info('Sector table seeded!');
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('sector', function (Blueprint $table) {
         $table->engine = 'InnoDB';
         $table->increments('id');
         $table->string('name')->index();
         $table->text('description')->nullable();
         $table->timestamps();
     });
     // FIXTURES Sectors
     $data = [];
     $file = file_get_contents(base_path() . '/database/fixtures/sectors.csv');
     $lines = str_getcsv($file, "\n");
     foreach ($lines as $line) {
         $keys = ['name'];
         $row = array_combine($keys, str_getcsv($line, ';'));
         Sector::create($row);
     }
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSector()
 {
     return $this->hasOne(Sector::className(), ['id' => 'address_sector_id']);
 }
 /**
  *map the sector to the village
  *
  * @param  int  $id
  * @return Response*/
 public static function map_sector($result, $village)
 {
     if (!empty($result->sector_id)) {
         $sectors = explode(",", $result->sector_id);
         if (!empty($sectors)) {
             foreach ($sectors as $sector) {
                 $sectorid = Sector::where('name', $sector)->first();
                 $savesec['village_id'] = $village->id;
                 $savesec['sector_id'] = $sectorid->id;
                 VillageSector::create($savesec);
             }
         }
     }
 }
示例#5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['card'] = $card = Card::find($id);
     if ($card) {
         $data['sectors'] = Sector::lists('name', 'id');
         $data['districts'] = District::groupby($this->district)->lists($this->district, 'id');
         $data['projects'] = Project::orderby('name', 'asc')->lists('name', 'id');
         $data['listbtn'] = Permission::hasPermission('cards.update');
         return view('cards.edit', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.card.notfound'));
         return Redirect::route('ruban.cards.index');
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['project'] = $project = Project::find($id);
     if ($project) {
         $data['sectors'] = Sector::lists('name', 'id');
         $data['states'] = State::lists('state', 'id');
         $data['districts'] = District::where('state_id', $data['project']->state_id)->lists('district', 'id');
         $data['taluks'] = Taluk::where('district_id', $data['project']->district_id)->lists('taluk', 'id');
         $data['cancelbtn'] = Permission::hasPermission('projects.index');
         return view('projects.edit', $data);
     } else {
         Session::flash($this->danger, Lang::get('ruban.project.notfound'));
         return Redirect::route('ruban.projects.index');
     }
 }
示例#7
0
 /**
  * Update the profile
  *
  * @param  int  $id
  * @return Response
  */
 public function updateprofile($id)
 {
     $data['user'] = User::findOrFail($id);
     $data['sectors'] = Sector::lists('name', 'id');
     $data['districts'] = District::lists('district', 'id');
     $districtsselected = PartnerDistrict::get_districts_selected($id);
     $data['districtsselected'] = PartnerDistrict::format_selected($districtsselected);
     $data['cancelbtn'] = Permission::hasPermission('users.index');
     return view('users.profile', $data);
 }