$masterproduksi = App\MasterProduksi::where('jenis_produksi', $pembudidaya->jenis_usaha)->get();
?>
															@foreach( $masterproduksi as $mp )
																<option value="{{ $mp->id }}" {{ $pembudidaya->produksi->nama == $mp->nama ? "selected":"" }}>{{ $mp->nama }}</option>
															@endforeach
														</select>
													</div>
												</div>
											</div>
											<div class="col-md-6">
												<div class="form-group">
													<label>Kepemilikan Sarana dan Prasarana</label>
													<div id="sarana">
														<select name="id_sarana[]" class="full-width" data-init-plugin="select2" multiple="">
															<?php 
$sarana = App\Sarana::where('jenis', $pembudidaya->jenisusaha->nama)->get();
?>
															<?php 
$Ksarana = App\KepemilikanSarana::where('id_user', $pembudidaya->id)->get();
?>
															<?php 
$Ksarana_arr = [];
?>
															@foreach ( $Ksarana as $val )
																<?php 
$Ksarana_arr[] = $val->id_sarana;
?>
															@endforeach

															@foreach( $sarana as $sa )
																<option value="{{ $sa->id }}" {{ in_array($sa->id, $Ksarana_arr) ? "selected":""}}>{{ $sa->sub }}</option>
Esempio n. 2
0
													<div class="form-group">
														<label>Kepemilikan Sarana dan Prasarana</label>
														<select name="id_sarana[]" class="full-width" data-init-plugin="select2" multiple="" data-placeholder="Pilih Sarana / Prasaranan...">

															<optgroup label="Bantuan">
															<?php 
$PK = App\Sarana::where('tipe', 'Pengolah')->where('jenis', 'Bantuan')->get();
?>
															@foreach( $PK as $rpk )
																<option value="{{ $rpk->id }}">{{ $rpk->sub }}</option>
															@endforeach
															</optgroup>

															<optgroup label="Swadaya">
															<?php 
$PK = App\Sarana::where('tipe', 'Pengolah')->where('jenis', 'Swadaya')->get();
?>
															@foreach( $PK as $rpk )
																<option value="{{ $rpk->id }}">{{ $rpk->sub }}</option>
															@endforeach
															</optgroup>
														</select>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label>Legalitas Produksi</label>
 public function run()
 {
     App\Sarana::truncate();
     $data = array(array('jenis' => 'Budidaya Air Laut', 'sub' => 'Para-para', 'tipe' => 'Pembudidaya'), array('jenis' => 'Budidaya Air Laut', 'sub' => 'Perahu', 'tipe' => 'Pembudidaya'), array('jenis' => 'Budidaya Air Tawar', 'sub' => 'Luas Lahan < 1 Ha', 'tipe' => 'Pembudidaya'), array('jenis' => 'Perahu Kapal', 'sub' => '< 5 GT', 'tipe' => 'Nelayan'), array('jenis' => 'Alat Tangkap', 'sub' => 'Pancing', 'tipe' => 'Nelayan'), array('jenis' => 'Mesin', 'sub' => '< 5 PK', 'tipe' => 'Nelayan'));
     DB::table('app_sarana')->insert($data);
 }
															<option value="{{ $rpk->id }}" {{ in_array($rpk->id, $Ksarana_arr) ? "selected":""}}>{{ $rpk->sub }}</option>
														@endforeach
														</optgroup>

														<optgroup label="Alat Tangkap">
														<?php 
$PK = App\Sarana::where('tipe', 'Nelayan')->where('jenis', 'Alat Tangkap')->get();
?>
														@foreach( $PK as $rpk )
															<option value="{{ $rpk->id }}" {{ in_array($rpk->id, $Ksarana_arr) ? "selected":""}}>{{ $rpk->sub }}</option>
														@endforeach
														</optgroup>

														<optgroup label="Mesin">
														<?php 
$PK = App\Sarana::where('tipe', 'Nelayan')->where('jenis', 'Mesin')->get();
?>
														@foreach( $PK as $rpk )
															<option value="{{ $rpk->id }}" {{ in_array($rpk->id, $Ksarana_arr) ? "selected":""}}>{{ $rpk->sub }}</option>
														@endforeach
														</optgroup>
													</select>
												</div>
											</div>
										</div>

										<div class="clearfix"></div>
										<button class="btn btn-primary" type="submit">Simpan</button>
									</form>
								</div>
							</div>