Пример #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $idMidia = Midia::where('id_registro_tabela', $id)->where('id_tipo_midia', $this->tipo_midia)->first()->id_midia;
     $dados['imagens'] = Midia::find($idMidia)->multimidia()->where('id_midia', $idMidia)->get();
     $dados['dados'] = Imovel::findOrFail($id);
     return view('imovel', $dados);
 }
Пример #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $imovel = Imovel::where('id', $id)->first();
     $fotos = $imovel->fotos()->get();
     $caracteristicas = $imovel->caracteristicas()->get();
     $item = [$imovel, $fotos, $caracteristicas];
     return $item;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $imovelIds = Imovel::lists('id')->toArray();
     $caracteristicaIds = Caracteristica::lists('id')->toArray();
     foreach (range(1, 100) as $index) {
         DB::table('imovel_caracteristica')->insert(['imovel_id' => $faker->randomElement($imovelIds), 'caracteristica_id' => $faker->randomElement($caracteristicaIds), 'numero' => $faker->randomElement($array = array('2', '3', '1', '0'))]);
     }
 }
Пример #4
0
 public function updateStatus($status, $id)
 {
     try {
         $dado = Imovel::findOrFail($id);
         $dado->status = $status;
         $dado->save();
         session()->flash('flash_message', 'Status alterado com sucesso!');
     } catch (\Exception $e) {
         LogR::exception($dado, $e);
         session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage());
     }
     return Redirect::back();
 }