middleware('can:mail.index')->only('index','show'); $this->middleware('can:mail.create')->only('create','store'); $this->middleware('can:mail.edit')->only('edit','update'); $this->middleware('can:mail.destroy')->only('destroy'); } public function index() { $plantels=Plantel::all(); $users=User::with('roles')->get(); return view('mail.index',compact('users','plantels')); } /** * Show the form for creating a new resource. */ public function create() { // } /** * Store a newly created resource in storage. */ public function store(Request $request) { // } /** * Display the specified resource. */ public function show(string $id) { // } /** * Show the form for editing the specified resource. */ public function edit(string $id) { // } /** * Update the specified resource in storage. */ public function update(Request $request, string $id) { // } /** * Remove the specified resource from storage. */ public function destroy(string $id) { // } public function mailme(User $user){ Mail::to($user->email)->send(new ExampleMail($user)); session()->flash('swal',[ 'icon'=>'success', 'title'=>'Enviado!', 'text'=>'Se ha enviado el correo correctamente' ]); return redirect()->route('mail.index'); } }