Open rehacan opened 1 year ago
I found the solution.
src\MagicLink.php
change this function
public static function deleteMagicLinkExpired() { static::where(function ($query) { $query ->where('available_at', '<', Carbon::now()) ->orWhere(function ($query) { $query ->whereNotNull('max_visits') ->whereRaw('max_visits <= num_visits'); }); }) ->delete(); }
to this
`public static function deleteMagicLinkExpired() { $expiredMagicLinks = static::where(function ($query) { $query ->where('available_at', '<', Carbon::now()) ->orWhere(function ($query) { $query ->whereNotNull('max_visits') ->whereRaw('max_visits <= num_visits'); }); })->get();
foreach ($expiredMagicLinks as $magiclink) {
// Delete from scroll short_urls containing control_id before magic link delete
$controlId = substr($magiclink->id, 0, 10); // First 10 characters of magic link id contain control_id
ShortUrl::where('destination_url', 'like', '%' . $controlId . '%')->delete();
// Magic linki sil
$magiclink->delete();
}
}`
and the solution, if expired magic links is deleting, then have to delete short_urls too..
Hi,
I'm using this script in my poll. Generating poll address for customers auto login and text message to mobile. Everything ok when i create new one. But when the expire the link, i need to update sometimes the link lifetime.. I research the database and i found in magic_links table, available_at column. I tried update this column data but still cannot open the poll. Bcos, the link is dead. What should i do?
edit: i checked again for available_at column change: first; i created new link for poll. Expire date 40 days later and i changed date today and i gave 1 hour for expire and work again. when i change it expired time, its forwarded to expired page and i changed 1 hour later again but its not working. I mean, if any link expired and visited expired link, then its not working anymore..