Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function update($id)
- {
- $datas = [];
- foreach (config('app.available_locale') as $index => $value)
- {
- $datas [$value] =
- [
- IndustriesTrans::where('locale',$value)->first()
- ];
- }
- $params =
- [
- 'datas' => $datas,
- 'untranslated' => Industries::find($id)
- ];
- return view('backend.industries.detail',$params);
- }
- public function store(Request $request)
- {
- $industries = $this->model->find($request->industries_id);
- if($request->hasFile('thumbnail'))
- {
- $thumbnail = $request->file('thumbnail');
- try{
- File::delete($industries->thumbnail);
- $thumbnail->move('backend/images/industries',$thumbnail->getClientOriginalName());
- $industries->update([
- 'thumbnail' => 'backend/images/industries/'.$thumbnail->getClientOriginalName()
- ]);
- }catch(Exception $e)
- {
- $e->getMessage();
- }
- }
- try{
- foreach (config('app.available_locale') as $index => $locale)
- {
- IndustriesTrans::updateOrCreate(
- [
- 'locale' => $locale,
- 'industries_id' => $request->industries_id
- ],
- [
- 'title' => $request->titles[$locale],
- 'content' => $request->contents[$locale],
- 'cta' => $request->ctas[$locale]
- ]);
- }
- }catch (Exception $e)
- {
- dd($e->getMessage());
- }
- return redirect()->route('industries_page');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement