public function sendMailout(Request $request)
    {
        $this->validate(
            $request,
            [
                'users'   => 'required|array',
                'subject' => 'required|min:4',
                'body'    => 'required|min:10',
            ]
        );

        $count = 0;

        foreach (User::all() as $user) {
            if (in_array($user->userId, $request->input('users'))) {
                $user->sendEmail(
                    $request->input('subject'),
                    'mustard::emails.mailout',
                    [
                        'body'     => $request->input('body'),
                        'username' => $user->username,
                    ]
                );

                $count++;
            }
        }

        return redirect()->back()->withStatus(trans('mustard::admin.mailout_sent', ['count' => $count]));
    }
public function sendMailout(Request $request)
    {
        $this->validate(
            $request,
            [
                'users'   => 'required|array',
                'subject' => 'required|min:4',
                'body'    => 'required|min:10',
            ]
        );

        $count = 0;

        foreach (User::all() as $user) {
            if (in_array($user->userId, $request->input('users'))) {
                $user->sendEmail(
                    $request->input('subject'),
                    'mustard::emails.mailout',
                    [
                        'body'     => $request->input('body'),
                        'username' => $user->username,
                    ]
                );

                $count++;
            }
        }

        return redirect()->back()->withStatus(trans('mustard::admin.mailout_sent', ['count' => $count]));
    }
public function sendMailout ( Request $ request ) { $ this -> validate ( $ request , [ 'users' => 'required|array' , 'subject' => 'required|min:4' , 'body' => 'required|min:10' , ] ) ; $ count = 0 ; foreach ( User :: all ( ) as $ user ) { if ( in_array ( $ user -> userId , $ request -> input ( 'users' ) ) ) { $ user -> sendEmail ( $ request -> input ( 'subject' ) , 'mustard::emails.mailout' , [ 'body' => $ request -> input ( 'body' ) , 'username' => $ user -> username , ] ) ; $ count ++ ; } } return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::admin.mailout_sent' , [ 'count' => $ count ] ) ) ; }
Send a mailout.

@return \Illuminate\Http\RedirectResponse
Send a mailout .