/** * Bootstrap any application services. * * @return void */ public function boot() { /**** * @ anasayfa validation rule */ Validator::extend('home', function ($attribute, $value, $parameters) { return !(\trslug::trslug($value) == 'anasayfa' || \trslug::trslug($value) == 'home'); }); /**** * @ ico validation rule */ Validator::extend('ico', function ($attribute, $value, $parameters) { return $value->getClientMimeType() == 'image/x-icon ' || $value->getClientMimeType() == 'image/vnd.microsoft.icon'; }); /**** * @ css validation rule */ Validator::extend('css', function ($attribute, $value, $parameters) { return $value->getClientMimeType() == 'text/css'; }); /**** * @ javascript validation rule */ Validator::extend('javascript', function ($attribute, $value, $parameters) { return $value->getClientMimeType() == 'application/javascript'; }); }
/** * Update the specified resource in storage. * * @param LinksRequest $request * @param int $id * @return \Illuminate\Http\Response */ public function update(LinksRequest $request, $id) { $link = Links::findOrFail($id); // $input = \Input::except('pdf', 'published_at'); $link->update($input); $link->slug = \trslug::trslug($link->title); $link->published_at = $this->carbon_parse(\Input::get('published_at')); if (\Input::file('pdf')) { $path = storage_path('app/pdf/') . '/' . $link->id; \File::cleanDirectory($path); $fileName = \trslug::trslug($link->title) . '.pdf'; \Input::file('pdf')->move($path, $fileName); $link->pdf = '/pdf/' . $link->id . '/' . $fileName; } if ($link->pdf != '') { $old_pdf = $link->pdf; $fileName = \trslug::trslug($link->title) . '.pdf'; $link->pdf = '/pdf/' . $link->id . '/' . $fileName; $path = storage_path('app'); $old_pdf != "" ? \File::move($path . $old_pdf, $path . $link->pdf) : NULL; } $link->save(); return \Redirect::back()->with('message', 'Kaydedildi!'); }
/** * Update the specified resource in storage. * * @param PhotosRequest $request * @param int $id * @return \Illuminate\Http\Response */ public function update(PhotosRequest $request, $id) { $photo = Photos::findOrFail($id); $old_slug = $photo->slug; $input = \Input::all(); $input['slug'] = '/img/photos/' . $photo->id . '/' . \trslug::trslug(\Input::get('title') . '.jpg'); $photo->update($input); \File::move(storage_path('app') . $old_slug, storage_path('app') . $photo->slug); // Photos::findOrFail($id)->update(\Input::all()); return \Redirect::back()->with('message', 'Kaydedildi!'); }
/** * Store a newly created resource in storage. * * @param AdminRequest $request * @return \Illuminate\Http\Response */ public function store(AdminRequest $request) { $config['brand'] = \Input::get('brand'); $config['mail'] = \Input::get('mail'); $config['active'] = \Input::get('active'); $config['eng'] = \Input::get('eng'); $config['one_page'] = \Input::get('one_page'); $config['googlemap'] = \Input::get('googlemap'); $config['header'] = \Input::get('header'); if (\Input::file('ico')) { \File::copy(\Input::file('ico'), public_path('favicon.ico')); } \File::put(storage_path('.config'), json_encode($config)); $custom_js = \Input::file('custom_js'); $custom_css = \Input::file('custom_css'); $custom_css ? $custom_css->move(storage_path('app/custom/css'), \trslug::trslug(pathinfo($custom_css->getClientOriginalName(), PATHINFO_FILENAME)) . '.css') : null; $custom_js ? $custom_js->move(storage_path('app/custom/js'), \trslug::trslug(pathinfo($custom_js->getClientOriginalName(), PATHINFO_FILENAME)) . '.js') : null; if (\Input::file('logo')) { \File::cleanDirectory(storage_path('app/img/.cache')); \Intervention::make(\Input::file('logo'))->save(storage_path('app/img/assets/logo.png')); } \Activity::log('Admin Anasayfa Güncellendi'); return \Redirect::back()->with('message', 'Kaydedildi!'); }
/** * Update the specified resource in storage. * * @param ContentRequest $request * @param int $id * @return \Illuminate\Http\Response */ public function update(ContentRequest $request, $id) { if (count(\Input::all()) == 1) { Content::find($id)->update(['title' => \Input::get('title')]); } else { // $content = Content::find($id); // content input $input['header'] = \Input::get('header'); $input['title'] = \Input::get('title'); $input['eng_title'] = \Input::get('eng_title'); $input['subtitle'] = \Input::get('subtitle'); $input['eng_subtitle'] = \Input::get('eng_subtitle'); // slug works $input['slug'] = \trslug::trslug($input['title']); $input['eng_slug'] = \trslug::trslug($input['eng_title']); $input['active'] = \Input::get('active') === "1"; $input['body'] = \Input::get('body'); $input['eng_body'] = \Input::get('eng_body'); $content->update($input); return \Redirect::back()->with('message', 'Kaydedildi'); } }
/** * Edit Slugs * * @param $id */ public function recursive_slug($id) { $menu = Menu::find($id); $this->slug = '/' . \trslug::trslug($menu->title) . $this->slug; $this->eng_slug = '/' . \trslug::trslug($menu->eng_title) . $this->eng_slug; if ($menu->parent) { $this->recursive_slug($menu->parent->id); } }