DeactivateAliasController.php 580 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Controllers;
  3. class DeactivateAliasController extends Controller
  4. {
  5. /**
  6. * Create a new controller instance.
  7. *
  8. * @return void
  9. */
  10. public function __construct()
  11. {
  12. $this->middleware('signed');
  13. $this->middleware('throttle:6,1');
  14. }
  15. public function deactivate($id)
  16. {
  17. $alias = user()->aliases()->findOrFail($id);
  18. $alias->deactivate();
  19. return redirect()->route('aliases.index')
  20. ->with(['status' => 'Alias ' . $alias->email . ' deactivated successfully!']);
  21. }
  22. }