PolicyController.php 653 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\Models\Policy;
  5. class PolicyController extends Controller
  6. {
  7. public function index($type)
  8. {
  9. $policy = Policy::where('name', $type)->first();
  10. return view('policies.index', compact('policy'));
  11. }
  12. //updates the policy pages
  13. public function store(Request $request){
  14. $policy = Policy::where('name', $request->name)->first();
  15. $policy->name = $request->name;
  16. $policy->content = $request->content;
  17. $policy->save();
  18. flash($request->name.' '.translate('updated successfully'));
  19. return back();
  20. }
  21. }