My users are able to tag other users in a comment, this returns the Username and the following markup:
<span class="atwho-inserted" data-atwho-at-query="@josh"><a href="/profile/joshuaTest" data-type="mentionable" data-id="undefined" data-name="joshuaTest">joshuaTest</a></span>
<span class="atwho-inserted" data-atwho-at-query="@jish"><a href="/profile/jishy" data-type="mentionable" data-id="undefined" data-name="jishy">jishy</a></span>
I'm doing a preg_match on some regex to retreive some data, I would then like to query based on these bits of data. Example:
$matches = array();
$t = preg_match_all('/data-name="(.*?)\"/', $str, $matches);
//I am aware that $t will provide an int of how many matches exist
$matches will give me exact usernames, with these I can query the database.
I would then like to do something like the following in side of a foreach, I am wondering if it's possible to loop this query with the results of the matched usernames
foreach($matches as $match)
{
$j = User::whereUsername($match[0,1,2,3 or whatever here (Until it equals $t)])->first();
}
and then notify the users found by their username via the Notifynder package:
Notifynder::category('userpropped')
->from(1)
->to(//UserID from above)
->url('/notifications')
->send();
Essentially, I would like to grab the users from their usernames, take their IDS and loop through them while passing them to the notifynder function
Is this something that I can achieve or have I gone about things in an incorrect fashion?
Thanks!