mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 15:33:44 +01:00
Added all providers cache
Added all providers cache
This commit is contained in:
parent
693af83f6b
commit
a005fc4576
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Providers;
|
||||
use DataTables;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ProvidersController extends Controller
|
||||
@ -30,6 +31,8 @@ class ProvidersController extends Controller
|
||||
'name' => $request->provider_name
|
||||
]);
|
||||
|
||||
Cache::forget('all_providers');
|
||||
|
||||
return redirect()->route('providers.index')
|
||||
->with('success', 'Provider Created Successfully.');
|
||||
}
|
||||
@ -62,6 +65,8 @@ class ProvidersController extends Controller
|
||||
|
||||
$items->delete();
|
||||
|
||||
Cache::forget('all_providers');
|
||||
|
||||
return redirect()->route('providers.index')
|
||||
->with('success', 'Provider was deleted Successfully.');
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Models\Providers;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class ProvidersSelect extends Component
|
||||
@ -15,8 +16,11 @@ class ProvidersSelect extends Component
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$all_providers = Cache::rememberForever('all_providers', function () {
|
||||
return Providers::all();
|
||||
});
|
||||
return view('components.providers-select', [
|
||||
'providers' => Providers::all()
|
||||
'providers' => $all_providers
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user