Ejemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     /**
      * Display All Companies
      */
     $companies = $this->companies->getAllOrderedByNameAsc();
     return view('companies.index', ['companies' => $companies]);
 }
 public function addAdvertisementInvite(AdvertisementRequest $request, User $user, Company $company, Advertisement $advertisement, Picture $picture)
 {
     $this->valid_image($request->images);
     $images = ImageManagement::upload_image($request->file('images'));
     $newUser = $user->findOrCreate($request);
     if ($request->user_type) {
         $newCompany = $company->create($request, $newUser->id);
         $newUser = $newCompany->company()->associate($newUser);
     }
     $newAdvertisement = $advertisement->create($request);
     $newAdvertisement->user()->associate($newUser);
     $newAdvertisement = $advertisement->associateIdType($request['ads_type'], $newAdvertisement);
     $newAdvertisement = $advertisement->associateIdCategory($request['category'], $newAdvertisement);
     $newAdvertisement = $advertisement->associateIdCity($request['id_city'], $newAdvertisement);
     foreach ($images as $value) {
         $newAdvertisement->picture[] = $picture->create($value);
     }
     Session::put('advertisement', $newAdvertisement);
     return Redirect::route('advertisement.invite.validation');
 }
Ejemplo n.º 3
0
 /**
  * Handle the registration of user.
  * 
  * @param type UserRegisterRequest $request 
  * @return type view
  */
 public function postRegister(UserRegisterRequest $request, User $user, Company $company)
 {
     $newUser = $user->store($request);
     if ($request->user_type) {
         $company->store($request, $newUser->id);
     }
     return Redirect::route('auth.register.success')->with('user', $newUser);
 }