Sending ics/ical emails via Laravel 8 - laravel

I am working on a laravel app and I would like to send meeting/calendar invites that go directly to the users calendar. For example, how calendly does it. The invite should automatically appear on the recipients calendars. Currently I have been able to attach them to the email, but not send directly. This may just be something I missed in the Laravel Mail docs and need to send this exact file instead of an email, but not as an attachment. I cannot seem to figure out how to do this either.
I currently looked around stackoverflow and did not find a clean implementation of this for laravel despite it being a pretty common feature. I have tried Spatie, Eluceo, and INSAN packages on github and did not have much luck. The code below works for downloading a .ics file.
I would appreciate any helpful comments! I have spent a long time looking into this already with little progress.
use INSAN\ICS;
$properities = [
'uid' => uniqid(),
'sequence' => 0,
'description' => 'Event Invitation via email.',
'dtstart' => date('2021-05-01 09:00'),
'dtend' => date('2021-05-01 10:00'),
'summary' => 'This is an event invitation sent through email.',
'location' => 'VR Punjab, S.A.S Nagar, Chandigarh',
'url' => 'www.example.com',
];
$ics_file = new ICS($properities);
return $ics_file->toString();

Related

how to check which users are signed in

i am beginner to code igniter. i am creating web service for android application that will have thousands of users. In admin panel i want to know which users are currently active. is it possible using sessions?
$newdata = array(
'phone' => $phone,
'pass' => $pass,
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
storing user data in session like this but don't know how to check later
To track online users you can add one flag(field) like "is_loggedin".
When any user login update this value to 1
When any user logout date this flag to 0
So you can check any time in database that user's with flag 1 are online.

Facebook adgroup creation - Invalid parameter

I am having an issue promoting an unpublished page post via the ads-api.
This was previously working ok for me, but began causing problems yesterday.
I first create an ad_campaign, and then, using the returned campaign_id, I attempt to create an adgroup.
The response from the server is
array(1) {
'error' =>
array(3) {
'message' =>
string(53) "(#100) Invalid parameter: adgroup_spec["campaign_id"]"
'type' =>
string(14) "OAuthException"
'code' => int(100)
}
}
I have verified that I am sending over the correct, newly created campaign_id.
Another point of interest; when I use the UI to delete the ad_campaign afterwards, I am told that I do not have permission to do so. User XXXX does not have permission to access campaign YYYY.
I'm thinking this must be an access_token/permission issue but I'm stumped. The ad objects are created using the user's token, and the unpublished page post is created using the page's access token.
NB: I can provide snippets if needs be, but I'm fairly sure this is a problem with the object creation flow as opposed to a code issue.
Has anyone seen anything similar?
Cheers, Gary
Update with POST data
array(7) {
'campaign_id' =>
int(6013621027457)
'bid_type' =>
int(6)
'bid_info' =>
string(37) "{"clicks":10,"reach":10,"actions":80}"
'conversion_specs' =>
string(66) "{"action.type":"offsite_conversion","offsite_pixel":6013619180457}"
'creative' =>
string(86) "{"type":27,"object_id":407012979370770,"auto_update":false,"story_id":565852233486843}"
'name' =>
string(23) "PropelAd (via PropelAd)"
'targeting' =>
string(95) "{"countries":["IE","AE","GB"],"friends_of_connections":[407012979370770],"page_types":["feed"]}"
}
Yes, it happens to me as well from time to time when uploading ads.
It's very statistical, and it seems to be an off-sync between Facebook servers (the campaign was already successfully uploaded, but the ad-request-handler does not recognize that id).
Wait a few seconds, and try again - after a few shots, it will always work (usually there's no problem, it's pretty rare but happens - and never lasted more than a minute of not-recognizing).
Perhaps it happened more today, due to the general Facebook failures.
I can only assume/hope that Facebook keep track of these errors, and are working on minimizing them by syncing their servers better.
Yep - we are currently putting a lot of time in checking why do ad group fail on unpublished posts - specifically on posts scheduled in the future.
The behavior is very inconsistent. The errors we get are slightly different: "Could not save ad", "Invalid ad creative". The errors are not reported on all ad groups but mostly on one of the ad groups of a whole batch.
We do make sure that the campaign start time is equal or AFTER the time the post is scheduled to.
When we publish the post now and test with the same campaign structure it succeeds (although this also succeeds sometimes on the second try - like it was mentioned here, that the campaign takes some time maybe to become fully valid)
A related bug I opened is here:
https://developers.facebook.com/bugs/593878450648811?browse=external_tasks_search_results_52662e53c59bd2e63625449

Post in Google+ stream is not showing up in user's stream using google-api-PHP-client

I'm trying to post in a user's Google+ stream, and I'm trying it using the google-api PHP client. Until now, I've been able of configure a test environment using the latest google-api PHP client and an example script (See 401 Unauthorized access when posting Google+ Moments with PHP Client for more information). It looks like it posts, because it returns an array with the answer, but nothing shows up in the user stream.
The answer array is:
Array (
[kind] => plus#moment
[type] => http://schemas.google.com/AddActivity
[target] => Array (
[kind] => plus#itemScope
[url] => https://developers.google.com/+/plugins/snippet/examples/thing
)
[result] => Array (
[kind] => plus#itemScope
)
[id] => xxxxxxxxx
)
which looks correct. Does anyone know why this is happens and how to solve it? Thank you!
App activities do not render in the user's stream but instead render in the app activities section of Google+ here:
https://plus.google.com/apps/
To prevent spam in the stream, the user must explicitly share to their stream in Google+. You can do this using Shares and Interactive Posts.

CakePHP when using uploadedit validation, save fails

Okay, so I am uploading documents when a user registers on my site, I collect some personal information and save it. Now I have had a bit of a problem, I split up the main registration form into a couple of view, where the user once logged in can now edit certain information, like for example one field called personal_introduction. For some reason this wont save, even though there are no validation errors on the field. Messed around in the model, to try pick up the problem and fount THIS causes the problem:
'document_file' => array(
'checkuploadedit' =>array(
'rule' => array('checkUpload', false),
'message' => 'Please select your document.',
),
'checkuploadedit' => array(
'rule' => array('extension', array('doc', 'docx', 'txt', 'rtf')),
'message' => 'File extentions allowed: .doc .docx .txt .rtf - we do NOT accept pdf format.'
)
),
Once I remove this from my model, it saves the data. Now its weird for me that the main registration form gives no problems, and that this view that does not even contain a form input called "document_file" fails the save.
Any ideas...Please!!! Obviously I need to validate the upload.
I tried this: validation on a input file in cakephp , thinking that maybe the above code is not correct, still no luck.
Thanks in advance for your answers.
Cheers Louis.
I went on to further investigate the problem, and found the following, which I still cant explain. When submitting views that do not contain the upload form on the same model, it still tries to validate the upload form, I could actually see the value for one as if submitted, even though it was not. so the only solution I got was to go use unset($this->data['user']['document']) for the actions which do not have the document upload form field. Hope this makes sense.

Anyone know how to access the magento gift card sku in transactional email template?

I had a custom utility task that allowed users to choose an image to accompany the gift card notice that is sent to the recipient when a gift card is purchased at the magento run shop. In the template, there is an assortment of variables available so you can customize the email that is sent. However, in order to add the correct image, I need to have access to the gift card sku number since my method for handling this was to simply create many gift cards and apply separate images for each one, then use javascript to swap the sku numbers when the user clicks the images. Simple enough.
In the app/code/core/Enterprise/GiftCard/Model/Observer.php file, the variables are set:
$templateData = array(
'name' => $item->getProductOptionByCode('giftcard_recipient_name'),
'email' => $item->getProductOptionByCode('giftcard_recipient_email'),
'sender_name_with_email' => $sender,
'sender_name' => $senderName,
'gift_message' => $item->getProductOptionByCode('giftcard_message'),
'giftcards' => $codeList->toHtml(),
'balance' => $balance,
'is_multiple_codes' => 1 < $goodCodes,
'store' => $order->getStore(),
'store_name' => $order->getStore()->getName(), // #deprecated after 1.4.0.0-beta1
'is_redeemable' => $isRedeemable,
);
So I could add the product sku to this array and it would be available in the template system. Problem is, I don't know where to trace this back to even know how to get the Sku. I assume it is somehow available in the $item var, but magento has no documentation on this particular case and I can't guess since there is no method for testing. The email script is activated when the card is purchased so I can't just click a "Send test" button to see what comes out in the email that is sent to the user. The preview button dismisses variables.
Anyone happen to know about this? Possibly something like $item->getSku()
Any input helps.
Thanks
That snippet is from the method Enterprise_GiftCard_Model_Observer::generateGiftCardAccounts() which is registered as a handler for sales_order_save_after event. That event is passed the same 'order' object as the "new order placed" emails have. You can experiment by altering that email template and triggering a new email by resending from the order page in admin.
$item->getSku() is almost certainly right.

Resources