/** * Execute the job. * * @param Age $age */ public function handle(Age $age) { /** * Save all Countries */ $this->ages->transform(function ($data) use($age) { $e = collect(explode('/', $data)); return $age->create(['from' => $e->first(), 'to' => $e->last()]); }); /** * Announce CountryWasCreated */ event(new AgeWasCreated($this->ages->toArray())); }
/** * @param Role $role * @param Country $country * @param Age $age * @return mixed */ public function showRegistrationForm(Role $role, Country $country, Age $age) { $param = collect(); return view('web.users.create', compact('param'))->with('roles', $role->all())->with('countries', $country->all())->with('ages', $age->all()); }
/** * Edit User * * @param User $user * @param Role $role * @param Country $country * @param Age $age * @return \Illuminate\Http\RedirectResponse */ public function edit(User $user, Role $role, Country $country, Age $age) { return view('users.edit', compact('user'))->with('roles', $role->all())->with('countries', $country->all())->with('ages', $age->all()); }
/** * Return all ages * * @param Age $age * @return \Illuminate\Http\JsonResponse */ public function ages(Age $age) { return response()->json($age->all()); }