Google Birthday Calendar Wrong Year - google-api

I am having issue when i am getting google birthday calendar. I am getting wrong year in google birthday calendar.
Ex:
In my google contacts i am having contact name - Deepak whose birthday - 19/04/1990. So this contact birthday showing in the google birthday calendar. When i am fetching google birthday calendar i am getting date like 2017-04-19, 2018-04-19, 2019-04-19. How can i get contact exact birthday with year from google birthday calendar?
Response From Google Calendar API
[0] => Array
(
[kind] => calendar#event
[etag] => "3060534890000000"
[id] => 2017_BIRTHDAY_4a7a6b868dd53910
[status] => confirmed
[htmlLink] => https://www.google.com/calendar/event?eid=MjAxN19CSVJUSERBWV80YTdhNmI4NjhkZDUzOTEwICNjb250YWN0c0B2
[created] => 2018-06-29T10:17:25.000Z
[updated] => 2018-06-29T10:17:25.000Z
[summary] => Deepak's birthday
[description] => This is Deepak's birthday!
[creator] => Array
(
[email] => #contacts#group.v.calendar.google.com
[displayName] => Contacts
[self] => 1
)
[organizer] => Array
(
[email] => #contacts#group.v.calendar.google.com
[displayName] => Contacts
[self] => 1
)
[start] => Array
(
[date] => 2017-06-30
)
[end] => Array
(
[date] => 2017-07-01
)
[visibility] => public
[iCalUID] => 2017_BIRTHDAY_4a7a6b868dd53910#google.com
[sequence] => 0
[gadget] => Array
(
[iconLink] => https://calendar.google.com/googlecalendar/images/cake.gif
[preferences] => Array
(
[goo.contactsGivenName] => Deepak
[goo.contactsEventType] => BIRTHDAY
[goo.contactsFullName] => Deepak
[goo.isGPlusUser] => false
[goo.contactsContactId] => 4a7a6b868dd53910
[goo.contactsIsMyContact] => true
)
)
[reminders] => Array
(
[useDefault] => 1
)
)
[1] => Array
(
[kind] => calendar#event
[etag] => "3060534890000000"
[id] => 2018_BIRTHDAY_4a7a6b868dd53910
[status] => confirmed
[htmlLink] => https://www.google.com/calendar/event?eid=MjAxOF9CSVJUSERBWV80YTdhNmI4NjhkZDUzOTEwICNjb250YWN0c0B2
[created] => 2018-06-29T10:17:25.000Z
[updated] => 2018-06-29T10:17:25.000Z
[summary] => Deepak's birthday
[description] => This is Deepak's birthday!
[creator] => Array
(
[email] => #contacts#group.v.calendar.google.com
[displayName] => Contacts
[self] => 1
)
[organizer] => Array
(
[email] => #contacts#group.v.calendar.google.com
[displayName] => Contacts
[self] => 1
)
[start] => Array
(
[date] => 2018-06-30
)
[end] => Array
(
[date] => 2018-07-01
)
[visibility] => public
[iCalUID] => 2018_BIRTHDAY_4a7a6b868dd53910#google.com
[sequence] => 0
[gadget] => Array
(
[iconLink] => https://calendar.google.com/googlecalendar/images/cake.gif
[preferences] => Array
(
[goo.contactsGivenName] => Deepak
[goo.contactsEventType] => BIRTHDAY
[goo.contactsFullName] => Deepak
[goo.isGPlusUser] => false
[goo.contactsContactId] => 4a7a6b868dd53910
[goo.contactsIsMyContact] => true
)
)
[reminders] => Array
(
[useDefault] => 1
)
)
[2] => Array
(
[kind] => calendar#event
[etag] => "3060534890000000"
[id] => 2019_BIRTHDAY_4a7a6b868dd53910
[status] => confirmed
[htmlLink] => https://www.google.com/calendar/event?eid=MjAxOV9CSVJUSERBWV80YTdhNmI4NjhkZDUzOTEwICNjb250YWN0c0B2
[created] => 2018-06-29T10:17:25.000Z
[updated] => 2018-06-29T10:17:25.000Z
[summary] => Deepak's birthday
[description] => This is Deepak's birthday!
[creator] => Array
(
[email] => #contacts#group.v.calendar.google.com
[displayName] => Contacts
[self] => 1
)
[organizer] => Array
(
[email] => #contacts#group.v.calendar.google.com
[displayName] => Contacts
[self] => 1
)
[start] => Array
(
[date] => 2019-06-30
)
[end] => Array
(
[date] => 2019-07-01
)
[visibility] => public
[iCalUID] => 2019_BIRTHDAY_4a7a6b868dd53910#google.com
[sequence] => 0
[gadget] => Array
(
[iconLink] => https://calendar.google.com/googlecalendar/images/cake.gif
[preferences] => Array
(
[goo.contactsGivenName] => Deepak
[goo.contactsEventType] => BIRTHDAY
[goo.contactsFullName] => Deepak
[goo.isGPlusUser] => false
[goo.contactsContactId] => 4a7a6b868dd53910
[goo.contactsIsMyContact] => true
)
)
[reminders] => Array
(
[useDefault] => 1
)
)

Google calendar and google contacts are two different things. There is also a difference between a date of birth and a birthday. The former occurs only once the latter occurs once a year.
Ex: In my google contacts I am having contact name - Deepak whose birthday - 19/04/1990.
This is your entry in your address book for this user. Its the users date of birth.
So this contact birthday showing in the google birthday calendar. When i am fetching google birthday calendar i am getting date like 2017-04-19, 2018-04-19, 2019-04-19.
Google calendar birthday calendar gives you an event for each year for the users birthday that year. So that you dont forget to send flowers.
How can i get contact exact birthday with year from google birthday calendar?
You should be going though the google contacts api directly if you just want the data from your google contacts.

Related

Get patents data data only child has empty data in relationship?

I have a collection like the below. I need to fetch those users, whom does not uploaded documents. Now from the relationship, How can I fetch this?
[0] => Array
(
[id] => 2
[user_id] => 8
[referred_by] =>
........
[user_documents] =>
)
[1] => Array
(
[id] => 3
[user_id] => 9
[referred_by] =>
[reference_id] => NM1100008
.......
[user_documents] => Array
(
[id] => 1
[customer_id] => 3
[doc_type] => 1
[document] => N8xFORsPpkTayTQ9Ihyz0ly7QM62TJHxvHhSFQSN.png
[admin_comment] =>
[approve_status] => approve
[other_gov_id] =>
[doc_no] => 1
[created_at] => 2020-04-04 12:39:12
[updated_at] => 2020-04-06 13:57:01
[deleted_at] =>
)
)
I want to get rows only when user_documents is empty.. To get those users who does not uploaded documents to the system.
[user_documents] =>
Thanks in advance.
You can use laravel querying-relationship-absence
$users= User::doesntHave('user_documents')->get();
Depending on how you have setup your relations, something like this should work:
User::doesntHave('documents')->get();

How read pubdate field using willvincent/feeds plugin?

I use https://github.com/willvincent/feeds for reading rss and with all field I also need to get pubDate field.
iI did not find a method for it(I looked also in source app/library/AppRssImport.php file ) and I made some debugging, so methods
echo '<pre>$RssItem->data[\'child\']::'.print_r($RssItem->data['child'],true).'</pre>';
dd($RssItem->data['child']);
has next output:
$RssItem->data['child']::Array
(
[] => Array
(
[title] => Array
(
[0] => Array
(
[data] => Man died 'in agony' after stroke amid ambulance delays
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
[description] => Array
(
[0] => Array
(
[data] => Michelle Lane has PTSD and flashbacks of her husband screaming in pain as they went to hospital by car.
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
[link] => Array
(
[0] => Array
(
[data] => https://www.bbc.co.uk/news/uk-england-nottinghamshire-46795776
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
[guid] => Array
(
[0] => Array
(
[data] => https://www.bbc.co.uk/news/uk-england-nottinghamshire-46795776
[attribs] => Array
(
[] => Array
(
[isPermaLink] => true
)
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
[pubDate] => Array
(
[0] => Array
(
[data] => Thu, 10 Jan 2019 10:02:22 GMT
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
)
[http://search.yahoo.com/mrss/] => Array
(
[thumbnail] => Array
(
[0] => Array
(
[data] =>
[attribs] => Array
(
[] => Array
(
[width] => 1024
[height] => 576
[url] => http://c.files.bbci.co.uk/15CE0/production/_105121398_michelle-tony.jpg
)
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
)
)
and https://imgur.com/a/wTmd9cV
I tried to read value of pubDate field, but failed. This structure was rather strange for me...
Which is right decision ?
You can use the get_date() method to grab the value of pubDate?
https://github.com/willvincent/feeds this plugin is only a wrapper around SimplePie php extension. You can look into SimplePie documentation for all other available methods. http://simplepie.org/api/class-SimplePie_Item.html.
A usable code might be like this. I used laravel, so the first line of grabbing the feed might be different.
$feed = Feeds::make('https://www.example.com/feed/');
$items = $feed->get_items();
foreach( $items as $key => $item ) {
$title = $item->get_title();
$guid = $item->get_id();
$pub_date = $item->get_date();
}

unable to get user email from payPal response (SDk rest api) in laravel after approved

I am going to integrate paypal in laravel! according to this
[http://www.17educations.com/laravel/paypal-integration-in-laravel/#disqus_thread][1]
Its work fine redirect paypal and verified and transation is done successfull
its ok and got response: as follow:
now how to get Email etc. from this response?
PayPal\Api\Payment Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[id] => PAY-6F912481CR395364MK5L5QFI
[intent] => sale
[state] => approved
[cart] => 4UA93426DX9093236
[payer] => PayPal\Api\Payer Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[payment_method] => paypal
[payer_info] => PayPal\Api\PayerInfo Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[email] => aassuamba99#gmail.com
[first_name] => Amba
[last_name] => Joshi
[payer_id] => 9B8FFYJJZEHM6
[shipping_address] => PayPal\Api\ShippingAddress Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[recipient_name] => Amba Joshi
[line1] => Flat no. 507 Wing A Raheja Residency
[line2] => Film City Road, Goregaon East
[city] => Mumbai
[state] => Maharashtra
[postal_code] => 400097
[country_code] => IN
)
)
[country_code] => IN
[billing_address] => PayPal\Api\Address Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[line1] => Flat no. 507 Wing A Raheja Residency
[line2] => Film City Road, Goregaon East
[city] => Mumbai
[state] => Maharashtra
[postal_code] => 400097
[country_code] => IN
)
)
)
)
)
)
[transactions] => Array
(
[0] => PayPal\Api\Transaction Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[amount] => PayPal\Api\Amount Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[total] => 50.00
[currency] => USD
[details] => PayPal\Api\Details Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
)
)
)
)
[description] => Your transaction description
[item_list] => PayPal\Api\ItemList Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[items] => Array
(
[0] => PayPal\Api\Item Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[name] => HEAD, NECK AND SHOULDER INC. MINI FACIAL MASSAGE
[price] => 50.00
[currency] => USD
[quantity] => 1
)
)
)
[shipping_address] => PayPal\Api\ShippingAddress Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[recipient_name] => Amba Joshi
[line1] => Flat no. 507 Wing A Raheja Residency
[line2] => Film City Road, Goregaon East
[city] => Mumbai
[state] => Maharashtra
[postal_code] => 400097
[country_code] => IN
)
)
)
)
[related_resources] => Array
(
[0] => PayPal\Api\RelatedResources Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[sale] => PayPal\Api\Sale Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[id] => 0W808156RU066263U
[state] => completed
[amount] => PayPal\Api\Amount Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[total] => 50.00
[currency] => USD
[details] => PayPal\Api\Details Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
)
)
)
)
[payment_mode] => INSTANT_TRANSFER
[protection_eligibility] => ELIGIBLE
[protection_eligibility_type] => ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE
[transaction_fee] => PayPal\Api\Currency Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[value] => 2.25
[currency] => USD
)
)
[parent_payment] => PAY-6F912481CR395364MK5L5QFI
[create_time] => 2016-06-08T08:32:59Z
[update_time] => 2016-06-08T08:32:59Z
[links] => Array
(
[0] => PayPal\Api\Links Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[href] => https://api.sandbox.paypal.com/v1/payments/sale/0W808156RU066263U
[rel] => self
[method] => GET
)
)
[1] => PayPal\Api\Links Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[href] => https://api.sandbox.paypal.com/v1/payments/sale/0W808156RU066263U/refund
[rel] => refund
[method] => POST
)
)
[2] => PayPal\Api\Links Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[href] => https://api.sandbox.paypal.com/v1/payments/payment/PAY-6F912481CR395364MK5L5QFI
[rel] => parent_payment
[method] => GET
)
)
)
[soft_descriptor] => PAYPAL *TESTFACILIT
)
)
)
)
)
)
)
)
[redirect_urls] => PayPal\Api\RedirectUrls Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[return_url] => http://localhost/massagess/payment/status?paymentId=PAY-6F912481CR395364MK5L5QFI
[cancel_url] => http://localhost/massagess/payment/status
)
)
[create_time] => 2016-06-08T08:33:00Z
[update_time] => 2016-06-08T08:32:55Z
[links] => Array
(
[0] => PayPal\Api\Links Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[href] => https://api.sandbox.paypal.com/v1/payments/payment/PAY-6F912481CR395364MK5L5QFI
[rel] => self
[method] => GET
)
)
)
)
)
Check this methods, preferably i think getPayer() is what u need:
http://paypal.github.io/PayPal-PHP-SDK/docs/class-PayPal.Api.Payment.html

Codeigniter Active record response differnt from MyPhpAdmin SQL query

I am getting a different result when I execute query in codeigniter active record form MyPhpAdmin
The following query run using MyPhpAdmin
SELECT * FROM (`ingredients`) LEFT JOIN `product_ingredients` ON `ingredients`.`ingredient_id` = `product_ingredients`.`ingredient_id` AND `product_id` = 46
gives the desired result which which includes the ingredient_id for both ingredient records that get returned.
Array ( [0] => stdClass Object ( [ingredient_id] => 1 [display] => Sweet Almond Oil [slug] => sweet-almond-oil [title] => Sweet Almond Oil [description] => Sweet Almond Oil [featured_image_url] => [product_ingredient_id] => 10 [product_id] => 46 [display_position] => 2 [key_ingredient] => 0 ) [1] => stdClass Object ( [ingredient_id] => 2 [display] => Shea Butter [slug] => shea-butter [title] => Shea Butter [description] => Shea Butter [featured_image_url] => [product_ingredient_id] => [product_id] => [display_position] => [key_ingredient] => ) )
But if I execute this query using Codeigniter Active record with the following code:
$this->db->select('*');
$this->db->join('product_ingredients', 'ingredients.ingredient_id = product_ingredients.ingredient_id AND `product_id` = 46', 'left');
$query = $this->db->get('ingredients');
Then the resulting array is missing the ingredient_id for the second ingredient result which is:
Array ( [0] => stdClass Object ( [ingredient_id] => 1 [display] => Sweet Almond Oil [slug] => sweet-almond-oil [title] => Sweet Almond Oil [description] => Sweet Almond Oil [featured_image_url] => [product_ingredient_id] => 10 [product_id] => 46 [display_position] => 2 [key_ingredient] => 0 ) [1] => stdClass Object ( [ingredient_id] => [display] => Shea Butter [slug] => shea-butter [title] => Shea Butter [description] => Shea Butter [featured_image_url] => [product_ingredient_id] => [product_id] => [display_position] => [key_ingredient] => ) )
Any help would be really appreciated...
Check it out
$this->db->select('i.*');
$this->db->from('ingredients i');
$this->db->join('product_ingredients pi', 'i.ingredient_id = pi.ingredient_id', 'left');
$this->db->where('pi.product_id',46);
$query = $this->db->get()->result_array();

multi-level comments error when deleting items from database

I have implemented a multi-level comment system where comments and their replies are pulled out of a SQL database and stored (via a PHP routine) in an array. Here is an example of the data structure of a comment which has 2 nested replies (main comment -> [child] reply -> [child] reply to reply):
Array ( [0] => stdClass Object ( **[self]** => stdClass Object ( [id] => 1 [page_id] => 47iNetBet [parent_id] => 0 [name] => adam 1 [email] => web#web.de [url] => [comment] => main comment [dt] => 2012-02-23 13:05:13 [ip] => 127.0.0.1 ) **[childs]** => Array ( [2] => stdClass Object ( [self] => stdClass Object ( [id] => 2 [page_id] => 47iNetBet [parent_id] => 1 [name] => adam 2 [email] => web#web.de [url] => [comment] => 1st reply [dt] => 2012-02-23 13:05:25 [ip] => 127.0.0.1 ) **[childs]** => Array ( [3] => stdClass Object ( [self] => stdClass Object ( [id] => 3 [page_id] => 47iNetBet [parent_id] => 2 [name] => adam 3 [email] => web#web.de [url] => [comment] => 2nd reply [dt] => 2012-02-23 13:05:35 [ip] => 127.0.0.1 ) **[childs]** => Array ( ) ) ) ) ) ) )
Each comment's parent_id refers to the id of its parent. If parent_id is zero then it's a main comment. This works fine - so far I have been able to add as many nested comments as I want without any problems. But it seems that as soon as I delete something from my database or even delete all the comments and then start adding new comments (even the exact same comments ids, parent_ids etc.) at some point the structure gets messed up. Here is the same example after deleting comments from database and repopulating database with the same comments data:
Array ( [0] => stdClass Object ( **[self]** => stdClass Object ( [id] => 1 [page_id] => 47iNetBet [parent_id] => 0 [name] => adam 1 [email] => web#web.de [url] => [comment] => main comment [dt] => 2012-02-23 13:05:13 [ip] => 127.0.0.1 ) **[childs]** => Array ( [2] => stdClass Object ( [self] => stdClass Object ( [id] => 2 [page_id] => 47iNetBet [parent_id] => 1 [name] => adam 2 [email] => web#web.de [url] => [comment] => 1st reply [dt] => 2012-02-23 13:14:40 [ip] => 127.0.0.1 ) **[childs] => Array (EMPTY???) ) ) )** [1] => stdClass Object ( [childs] => Array ( [3] => stdClass Object ( [self] => stdClass Object ( [id] => 3 [page_id] => 47iNetBet [parent_id] => 2 [name] => adam 3 [email] => web#web.de [url] => [comment] => 2nd reply [dt] => 2012-02-23 13:14:47 [ip] => 127.0.0.1 ) [childs] => Array ( ) ) ) ) )
As you can see in the latter example, the second child (main comment -> reply -> reply to reply) is an empty array. What should be in this array is now put at the end as some sort of independent/incomplete comment which breaks the flow of the display. If I drop the "comments" table and start a new one everything seems to work fine again until I start deleting stuff again.
I dont know how to explain, but this is weird. I cant imagine that there is something wrong with the code as everything seems to work fine otherwise. Could this have to do anything with the database itself? Maybe someone had a similar problem? Maybe someone could point me in the right direction. I dont even know where to start looking.
Any help, suggestions would be much appreciated.
Problem solved. It was indeed an error within the code. The records in the database need to be fetched in a certain order (sorted by parent_id in ascending order). It was as simple as that.

Resources