Ejemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Settings::get('show_contacts_page')) {
         return $next($request);
     } else {
         return new Response('', 404);
     }
 }
Ejemplo n.º 2
0
 /**
  * The attributes that are mass assignable.
  *
  * @var array
  */
 static function getSetting()
 {
     $Data = Settings::get()->all();
     $Result = [];
     foreach ($Data as $key => $value) {
         $Result[$value['key']] = $value['value'];
     }
     return $Result;
 }
Ejemplo n.º 3
0
 /**
  * Saves settings.
  */
 public function save()
 {
     foreach ($this->_attributes as $name => $value) {
         $_name = explode('.', $name);
         $settings = Settings::get($_name[0], $_name[1]);
         $settings->value = $value;
         $settings->save();
     }
 }
 /**
  * Handles avatar deletion
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getDeleteAvatar()
 {
     if (Settings::get('use_avatars')) {
         Session::put('profile_tab', 'avatar');
         $response = null;
         // If avatar presented - delete it
         if (Auth::user()->avatar) {
             $response = Icr::deleteImage(Auth::user()->avatar, 'avatar');
         }
         // Handle delete error
         if ($response instanceof \Exception) {
             flash()->error($response->getMessage());
             return redirect()->back();
         }
         Auth::user()->deleteAvatar();
         flash()->success(trans('users.avatar_deleted'));
     }
     return redirect()->back();
 }
 /**
  * Handles avatar deletion
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getDeleteAvatar()
 {
     if (Settings::get('use_avatars')) {
         Session::put('profile_tab', 'avatar');
         Auth::user()->deleteAvatar();
         flash()->success(trans('users.avatar_deleted'));
     }
     return redirect()->back();
 }
 /**
  * Deletes user avatar
  *
  * @param int $id User id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getDeleteAvatar($id)
 {
     if (Settings::get('use_avatars')) {
         $user = User::find($id);
         $user->deleteAvatar();
         $user->save();
         flash()->success(trans('users.avatar_deleted'));
         User::flushCache($user);
     }
     return redirect()->back();
 }
 /**
  * Delete favicon
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getDeleteFavicon()
 {
     Session::put('settings_tab', 'favicon');
     $path = public_path(Settings::get('favicon'));
     file_exists($path) ? unlink($path) : null;
     Settings::where('param', 'favicon')->update(['value' => null]);
     Cache::flush('settings');
     flash()->success(trans('settings.favicon_deleted'));
     return redirect()->back();
 }
 /**
  * Deletes user avatar
  *
  * @param int $id User id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getDeleteAvatar($id)
 {
     if (Settings::get('use_avatars')) {
         $user = User::find($id);
         $response = Icr::deleteImage($user->avatar, 'avatar');
         if ($response instanceof \Exception) {
             flash()->error($response->getMessage());
             return redirect()->back();
         }
         $user->deleteAvatar();
         $user->save();
         flash()->success(trans('users.avatar_deleted'));
         User::flushCache($user);
     }
     return redirect()->back();
 }