1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-01-17 21:28:30 +01:00

Remove Rememberable package as it causes too much headache right now

This commit is contained in:
Kovah 2019-03-22 17:02:36 +01:00
parent 9b3ed8cc7d
commit be77eb75a7
No known key found for this signature in database
GPG Key ID: AAAA031BA9830D7B
13 changed files with 10 additions and 240 deletions

View File

@ -68,8 +68,6 @@ class ImportController extends Controller
'updated_at' => Carbon::now(),
]);
Link::flushCache();
// Get all tags
if (!empty($link['tags'])) {
$tags = explode(' ', $link['tags']);
@ -81,8 +79,6 @@ class ImportController extends Controller
]);
$new_link->tags()->attach($new_tag->id);
Tag::flushCache();
}
}

View File

@ -83,7 +83,6 @@ class TrashController extends Controller
foreach ($entries as $entry) {
$entry->forceDelete();
$entry->flushCache();
}
alert(trans('trash.delete_success.' . $model), 'success');
@ -127,7 +126,6 @@ class TrashController extends Controller
}
$entry->restore();
$entry->flushCache();
alert(trans('trash.delete_restore.' . $model), 'success');

View File

@ -66,8 +66,6 @@ class CategoryController extends Controller
// Create the new link
$link = Category::create($data);
Category::flushCache();
alert(trans('category.added_successfully'), 'success');
if ($request->get('reload_view')) {
@ -167,8 +165,6 @@ class CategoryController extends Controller
// Update the existing category with new data
$category->update($data);
Category::flushCache();
alert(trans('category.updated_successfully'), 'success');
return redirect()->route('categories.show', [$category->id]);
@ -204,8 +200,6 @@ class CategoryController extends Controller
$category->delete();
Category::flushCache();
alert(trans('category.deleted_successfully'), 'warning');
return redirect()->route('categories.index');

View File

@ -84,8 +84,6 @@ class LinkController extends Controller
// Create the new link
$link = Link::create($data);
Link::flushCache();
// Get all tags
if ($tags = $request->get('tags')) {
$tags = explode(',', $tags);
@ -98,8 +96,6 @@ class LinkController extends Controller
$link->tags()->attach($new_tag->id);
}
Tag::flushCache();
}
alert(trans('link.added_successfully'), 'success');
@ -196,8 +192,6 @@ class LinkController extends Controller
$link->update($data);
Link::flushCache();
// Update all tags
if ($tags = $request->get('tags')) {
$tags = collect(explode(',', $tags));
@ -213,8 +207,6 @@ class LinkController extends Controller
}
$link->tags()->sync($new_tags);
Tag::flushCache();
}
alert(trans('link.updated_successfully'), 'success');
@ -244,8 +236,6 @@ class LinkController extends Controller
$link->delete();
Link::flushCache();
alert(trans('link.deleted_successfully'), 'warning');
return redirect()->route('links.index');

View File

@ -30,9 +30,6 @@ class NoteController extends Controller
$note = Note::create($data);
Note::flushCache();
Link::flushCache();
alert(trans('note.added_successfully'), 'success');
return redirect()->route('links.show', [$link->id]);
@ -79,9 +76,6 @@ class NoteController extends Controller
$note->update($data);
Note::flushCache();
Link::flushCache();
alert(trans('note.updated_successfully'), 'success');
return redirect()->route('links.show', [$note->link->id]);
@ -110,9 +104,6 @@ class NoteController extends Controller
$link = $note->link->id;
$note->delete();
Note::flushCache();
Link::flushCache();
alert(trans('note.deleted_successfully'), 'success');
return redirect()->route('links.show', [$link]);

View File

@ -63,8 +63,6 @@ class TagController extends Controller
$tag = Tag::create($data);
Tag::flushCache();
alert(trans('tag.added_successfully'), 'success');
if ($request->get('reload_view')) {
@ -158,8 +156,6 @@ class TagController extends Controller
$tag->update($data);
Tag::flushCache();
alert(trans('tag.updated_successfully'), 'success');
return redirect()->route('tags.show', [$tag->id]);
@ -190,9 +186,6 @@ class TagController extends Controller
$tag->delete();
Link::flushCache();
Tag::flushCache();
return redirect()->route('tags.index');
}
}

View File

@ -5,8 +5,8 @@ namespace App\Models;
use App\Scopes\OrderNameScope;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Cache;
/**
* Class Category
@ -27,7 +27,7 @@ use Illuminate\Support\Facades\Cache;
* @method static Builder|Category parentOnly()
* @method static Builder|Category byUser($user_id)
*/
class Category extends RememberedModel
class Category extends Model
{
use SoftDeletes;
@ -41,20 +41,6 @@ class Category extends RememberedModel
'is_private',
];
/**
* Category constructor.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
if (useCacheTags()) {
$this->rememberCacheTag = 'category_queries';
}
parent::__construct($attributes);
}
/**
* Add the OrderNameScope to the Tag model
*/
@ -127,23 +113,4 @@ class Category extends RememberedModel
{
return $this->belongsTo(Category::class, 'parent_category');
}
/*
| ========================================================================
| METHODS
*/
/**
* Conditionally flush cache based on cache driver
*
* @return void
*/
public static function flushCache()
{
if (useCacheTags()) {
parent::flushCache();
} else {
Cache::flush();
}
}
}

View File

@ -4,8 +4,8 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Cache;
/**
* Class Link
@ -29,7 +29,7 @@ use Illuminate\Support\Facades\Cache;
* @property-read User $user
* @method static Builder|Link byUser($user_id)
*/
class Link extends RememberedModel
class Link extends Model
{
use SoftDeletes;
@ -46,20 +46,6 @@ class Link extends RememberedModel
'status',
];
/**
* Link constructor.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
if (useCacheTags()) {
$this->rememberCacheTag = 'link_queries';
}
parent::__construct($attributes);
}
/*
| ========================================================================
| SCOPES
@ -191,18 +177,4 @@ class Link extends RememberedModel
return $output;
}
/**
* Conditionally flush cache based on cache driver
*
* @return void
*/
public static function flushCache()
{
if (useCacheTags()) {
parent::flushCache();
} else {
Cache::flush();
}
}
}

View File

@ -3,8 +3,8 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Cache;
/**
* Class Note
@ -22,7 +22,7 @@ use Illuminate\Support\Facades\Cache;
* @property-read User $user
* @method static Builder|Link byUser($user_id)
*/
class Note extends RememberedModel
class Note extends Model
{
use SoftDeletes;
@ -35,20 +35,6 @@ class Note extends RememberedModel
'is_private',
];
/**
* Note constructor.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
if (useCacheTags()) {
$this->rememberCacheTag = 'note_queries';
}
parent::__construct($attributes);
}
/*
| ========================================================================
| SCOPES
@ -107,18 +93,4 @@ class Note extends RememberedModel
return $output;
}
/**
* Conditionally flush cache based on cache driver
*
* @return void
*/
public static function flushCache()
{
if (useCacheTags()) {
parent::flushCache();
} else {
Cache::flush();
}
}
}

View File

@ -1,21 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Watson\Rememberable\Rememberable;
/**
* Class Model
*
* @package App\Models
*/
abstract class RememberedModel extends BaseModel
{
use Rememberable;
/**
* @var int Duration in minutes how long model queries should be cached
*/
public $rememberFor = 60;
}

View File

@ -5,8 +5,8 @@ namespace App\Models;
use App\Scopes\OrderNameScope;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Cache;
/**
* Class Tag
@ -23,7 +23,7 @@ use Illuminate\Support\Facades\Cache;
* @property-read User $user
* @method static Builder|Tag byUser($user_id)
*/
class Tag extends RememberedModel
class Tag extends Model
{
use SoftDeletes;
@ -35,20 +35,6 @@ class Tag extends RememberedModel
'is_private',
];
/**
* Tag constructor.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
if (useCacheTags()) {
$this->rememberCacheTag = 'tag_queries';
}
parent::__construct($attributes);
}
/**
* Add the OrderNameScope to the Tag model
*/
@ -96,23 +82,4 @@ class Tag extends RememberedModel
{
return $this->belongsToMany('App\Models\Link', 'link_tags', 'tag_id', 'link_id');
}
/*
| ========================================================================
| METHODS
*/
/**
* Conditionally flush cache based on cache driver
*
* @return void
*/
public static function flushCache()
{
if (useCacheTags()) {
parent::flushCache();
} else {
Cache::flush();
}
}
}

View File

@ -12,8 +12,7 @@
"predis/predis": "^1.1",
"shaarli/netscape-bookmark-parser": "^2.1",
"spatie/laravel-backup": "^5.12.0",
"vinkla/alert": "^3.0.0",
"watson/rememberable": "^2.0"
"vinkla/alert": "^3.0.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",

50
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3ad05b6238e40bae6262012247138c98",
"content-hash": "98d41f784552af728daa5eed8c259e5f",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@ -3856,54 +3856,6 @@
],
"time": "2019-01-29T11:11:52+00:00"
},
{
"name": "watson/rememberable",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/dwightwatson/rememberable.git",
"reference": "8718614835370f67f58d86387a26bfc315fa9a8b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dwightwatson/rememberable/zipball/8718614835370f67f58d86387a26bfc315fa9a8b",
"reference": "8718614835370f67f58d86387a26bfc315fa9a8b",
"shasum": ""
},
"require": {
"illuminate/database": "~5.0",
"illuminate/support": "~5.0",
"php": ">=5.4.0"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "4.2.*"
},
"type": "library",
"autoload": {
"psr-4": {
"Watson\\Rememberable\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dwight Watson",
"email": "dwight@studiousapp.com"
}
],
"description": "Query caching for Laravel 5",
"keywords": [
"caching",
"eloquent",
"laravel",
"remember"
],
"time": "2017-12-21T01:09:18+00:00"
},
{
"name": "zendframework/zend-diactoros",
"version": "1.8.6",