Hi I'm using laravel spatie for manage user roles and permissions. What I need is to get a list of user emails with a specific role. Here is my code.
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;
use Spatie\Permission\Models\Role;
use Auth;
class StripeController extends Controller {
public function subscribe(Request $request) {
$users = User::select('email')->get();
var_dump($users->pluck('email'));
exit();
}
}
In this code I get mails of all users. But I need only users have the role admin. It would be great if someone can help. I'm using this package to get roles.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2IOSFS2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire