/**
  * Changes the content in About Us page as required
  * and returns to the admin's about us edit page.
  *
  * @param EditAboutUsRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function editContent(EditAboutUsRequest $request)
 {
     $img = $request->file('bannerImg');
     if ($img != null || $img != '') {
         $upload_path = public_path() . "/FrontEnd/img/about_us/";
         // for more on Laravel upload handling: http://clivern.com/how-to-create-file-upload-with-laravel/
         $img->move($upload_path, 'about_us2.jpg');
         // File Cache is cleared and rebuilt
         // Reason: Sometimes, even though the file has been changed, webpage displays the old file
         // even if it doesn't exist anymore. That nonexistant image comes from the file cache which is
         // used by Laravel to speedup web page loading speeds.
         Cache::flush();
     }
     if ($request->paragraph != null || $request->paragraph != '') {
         $content = $request->paragraph;
         $current_description = AboutUs::find(AboutUs::max('id'));
         if ($current_description == null) {
             $about_us = new AboutUs();
             $about_us->description = $content;
             $about_us->save();
         } else {
             $about_us = $current_description;
             $about_us->description = $content;
             $about_us->save();
         }
     }
     return redirect('admin_about_us')->with('status', 'About Us page was successfully updated.');
 }
Example #2
0
 public function clearCache()
 {
     Cache::flush();
     Logs::add('process', trans('whole::http/controllers.tools_log_1'));
     Flash::success(trans('whole::http/controllers.tools_flash_1'));
     return redirect()->route('admin.index');
 }
 public function clearCache()
 {
     Cache::flush();
     Logs::add('process', "Ön Bellek Temizlendi");
     Flash::success('Ön Bellek Başarıyla Temizlendi');
     return redirect()->route('admin.index');
 }
 /**
  * Handle permissions change
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function putAll(Request $request)
 {
     $permissions = Permission::all();
     $input = array_keys($request->input('permissions'));
     try {
         DB::beginTransaction();
         $permissions->each(function ($permission) use($input) {
             if (in_array($permission->id, $input)) {
                 $permission->allow = true;
             } else {
                 $permission->allow = false;
             }
             $permission->save();
         });
         DB::commit();
         flash()->success(trans('permissions.save_success'));
     } catch (\Exception $e) {
         var_dump($e->getMessage());
         die;
         flash()->error(trans('permissions.save_error'));
     }
     try {
         Cache::tags(['permissions'])->flush();
     } catch (\Exception $e) {
         Cache::flush();
     }
     return redirect()->back();
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getClear()
 {
     // Cache::forget('settings');
     // Cache::forget('popular_categories');
     Cache::flush();
     return redirect()->back()->withSuccess('Cache Cleared!');
 }
 /**
  * Clear app cache.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function clearCache()
 {
     Cache::flush();
     Artisan::call('config:clear');
     Artisan::call('clear-html');
     Notification::success(trans('settings::global.Cache cleared') . '.');
     return redirect()->route('admin::index-settings');
 }
Example #7
0
 public function __construct()
 {
     Cache::flush();
     //refresh elke keer voor development purpose...
     view()->share('euro', function ($number) {
         return number_format($number, 2, ',', '.');
     });
     view()->share('user', \Auth::user());
 }
 public static function updateSideBarCache()
 {
     $categories = Category::all();
     $posts = Post::orderBy('updated_at', 'desc')->limit(2)->get();
     if (Cache::has('categories') || Cache::has('posts')) {
         Cache::flush();
     }
     Cache::forever('posts', compact('posts'));
     Cache::forever('categories', compact('categories'));
 }
Example #9
0
 public function flushCaches()
 {
     Cache::flush();
     Session::flash('success', 'Les caches ont été effacés avec succès.');
     return redirect('admin');
 }
Example #10
0
 /**
  * Flush the users cache
  * 
  * @param \App\Models\User $user
  */
 public static function flushCache(User $user = null)
 {
     if ($user && $user->hasRole('admin')) {
         Cache::flush(['admin_users']);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $teacher = Teacher::find($id);
     if (!$teacher) {
         return $this->response->errorNotFound('Teacher not found');
     }
     $teacher->delete();
     // Bad
     Cache::flush();
     // Better
     //Cache::tags('teacher-' . $id)->flush();
 }
Example #12
0
 /**
  * Clears all cache data
  *
  * @example
  *          <code>
  *          //delete all cache
  *          mw()->cache->clear();
  *          </code>
  * @return boolean
  * @package Cache
  */
 public function clear()
 {
     return Cache::flush(true);
 }
 public function flush()
 {
     Cache::flush();
 }
 /**
  * Deletes favicon
  * 
  * @return Response
  */
 public function getDeleteFavicon()
 {
     Session::put('settings_tab', 'favicon');
     $path = public_path(Settings::getFavicon());
     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();
 }
Example #15
0
 /**
  * Flush entire cache.
  *
  * @author Morten Rugaard <*****@*****.**>
  * @return bool
  */
 public function wipe()
 {
     return IlluminateCache::flush();
 }
Example #16
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Artist::findOrfail($id)->delete();
     Cache::flush();
     return trans('all.entry_removed');
 }
Example #17
0
 /**
  * Remove all items from the cache.
  *
  * @return void
  */
 public static function flush()
 {
     static::$cache = array();
     parent::flush();
 }
 public function logout()
 {
     Cache::flush();
     return redirect('/');
 }
Example #19
0
 /**
  * Save edited page
  *
  * @return mixed
  */
 public function postEditpage()
 {
     $page_id = Input::get('page_id');
     if ($page_id > 0) {
         $page = CatraPage::find($page_id);
     } else {
         $page = new Page();
     }
     $page->page_title = trim(Input::get('page_title'));
     $page->active = Input::get('active');
     $page->page_content = trim(Input::get('page_content'));
     $page->meta = Input::get('meta');
     $page->meta_tags = Input::get('meta_tags');
     $page->slug = Str::slug(trim(Input::get('page_title')));
     if (Input::has('page_title_fr')) {
         $page->page_title_fr = Input::get('page_title_fr');
         $page->page_content_fr = Input::get('page_content_fr');
         $page->slug = Str::slug(trim(Input::get('page_title')));
     }
     if (Input::has('page_title_es')) {
         $page->page_title_es = Input::get('page_title_es');
         $page->page_content_es = Input::get('page_content_es');
         $page->slug_es = Str::slug(trim(Input::get('page_title_es')));
     }
     $page->save();
     $page_id = $page->id;
     // make sure we have a page details entry
     $detail = PageDetail::where('page_id', '=', $page->id)->first();
     if ($detail == null) {
         $detail = new PageDetail();
     }
     $detail->page_id = $page_id;
     $detail->page_category_id = Input::get("page_category_id");
     $detail->save();
     Cache::flush();
     return Redirect::to('/admin/page/all-pages')->with('message', 'Page saved successfully');
 }
Example #20
0
 /**
  * Remove all items from the cache.
  *
  * @return void
  */
 protected function flush()
 {
     Cache::flush();
 }
Example #21
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, PageRequest $request)
 {
     $page = Article::findOrFail($id);
     $page->update($request->all());
     $page->updateCat(['cat' => [1, $request->input('cat')], 'id' => $id]);
     Cache::flush();
     flash()->success(trans('pages.updated'));
     return redirect(action('Admin\\PagesController@index'));
 }
Example #22
0
 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function logout()
 {
     Auth::logout();
     Cache::flush();
     Session::flush();
     return redirect(\URL::previous());
     //        return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
 }
Example #23
0
    Cache::forget('optime/server');
    Cache::forget('optime/account');
    return response()->json(['result' => 'success'])->header('Access-Control-Allow-Origin', '*');
});
$app->get('/optime/{type}', ['as' => 'optime', 'middleware' => 'cache', function ($type) {
    if ($type !== 'account' && $type !== 'server') {
        return response()->json(['result' => 'error', 'reason' => 'invalid type']);
    }
    try {
        $optime = Optime::where('type', $type)->orderBy('id', 'desc')->firstOrFail();
        return response()->json(['time' => $optime['start_time'], 'comment' => $optime['comment']]);
    } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
        return response()->json(['result' => 'error', 'reason' => 'record not found']);
    }
}]);
//Purge cache
$app->get('/purge/{option}', function ($option) {
    if ($option == "all") {
        Cache::flush();
    } else {
        Cache::tags($option)->flush();
    }
    return $option . " cache has been purged!";
});
// Auto include router files
$router_files = scandir(dirname(__FILE__) . '/Routers');
foreach ($router_files as $i => $file) {
    if (strpos($file, '.php') > 0) {
        include_once "Routers/{$file}";
    }
}
Example #24
0
 public function flush()
 {
     return Cache::flush();
 }
Example #25
0
 public function active($id, Image $image)
 {
     Cache::flush();
     $image = $image->findOrFail($id);
     return trans('Gallery #' . $id . ' is ' . $image->imageStatus($image) . ' now');
 }
Example #26
0
 /**
  * This function checks that a deletion has occurred
  * @param $url - this URL SHOULD NOT include the id.  That will be appended
  * @param $model
  * @param $table
  * @param bool|true $softDelete - whether the model is set up for soft delete or not
  * @param null $sortable - - array ['url' => URL for list, 'context_id', 'context_type']
  */
 protected function checkAPIDelete($url, $model, $table, $softDelete = true, $sortable = null)
 {
     if ($model instanceof \Illuminate\Support\Collection) {
         $items = $model;
     } else {
         $items = factory($model, 10)->create()->toArray();
         Cache::flush();
     }
     $toDelete = 2;
     $this->login();
     $this->delete($url . '/' . $items[$toDelete]['id'], [], $this->api_header);
     $this->assertResponseStatus(200);
     if ($softDelete) {
         //Make sure record is still there after delete
         $this->seeInDatabase($table, ['id' => $items[$toDelete]['id']]);
     }
     $this->notSeeInDatabase($table, ['id' => $items[$toDelete]['id'], 'deleted_at' => null]);
     if ($sortable) {
         $this->post($sortable['url'], ['context_id' => $sortable['context_id'], 'context_type' => $sortable['context_type']], $this->api_header);
         $this->assertResponseOk();
         //Remove deleted id and reindex array
         unset($items[$toDelete]);
         $items = array_values($items);
         foreach ($items as $key => $item) {
             $this->seeJson(['order' => $key + 1]);
         }
     }
 }
Example #27
0
 public function active($id, Article $article)
 {
     Cache::flush();
     $article = $article->findOrFail($id);
     return trans('Movie #' . $id . ' is ' . $article->articleStatus($article) . ' now');
 }
Example #28
0
    Route::post('/admin/page/page', 'CatraPageController@postEditpage');
    Route::get('/admin/page/slider', 'PageController@getEditslider');
    Route::post('/admin/page/slider', 'PageController@postEditslider');
    Route::get('/admin/page/deleteimage', 'PageController@getDeletehomepageimage');
    Route::get('/admin/menus/menu', 'MenuController@getMenu');
    Route::get('/oromoctomenujson', 'MenuController@getMenuItemJson');
    Route::post('/admin/menus/saveitem', 'MenuController@postSavemenuitem');
    Route::get('/sortmenu', 'MenuController@sortMenu');
    Route::get('/deletemenuitem', 'MenuController@deleteItem');
});
// login
Route::get('/login', '\\Tsawler\\Vcms5\\controllers\\VcmsLoginController@getLogin');
// vcms5 package routes
Route::group(['namespace' => 'App\\Http\\Controllers'], function () {
    Route::get('/clearcache', function () {
        \Illuminate\Support\Facades\Cache::flush();
        return "flushed";
    });
    /**
     * Change language prefs
     */
    Route::get('/changelanguage', '\\Tsawler\\Vcms5\\controllers\\VcmsLanguageController@getChangeLanguage');
    /**
     * UI
     */
    Route::get('/menuUp', '\\Tsawler\\Vcms5\\controllers\\VcmsUIController@menuUp');
    Route::get('/menuDown', '\\Tsawler\\Vcms5\\controllers\\VcmsUIController@menuDown');
    /**
     * User login/password routes
     */
    Route::get('/admin/login', '\\Tsawler\\Vcms5\\controllers\\VcmsLoginController@getLogin');
Example #29
0
 /**
  * default clear cache method (clears all cache)
  */
 protected function clearCache()
 {
     Cache::flush();
 }
Example #30
0
 /**
  * Flush all the cached item
  */
 public function flush()
 {
     if (!$this->enable) {
         return;
     }
     Cache::flush();
 }