Did my research and found nothing about this topic.
In the docs: https://mailchimp.com/developer/marketing/guides/track-outside-activity-events/#create-an-event
Apparently said how to create an event with options, using the library that they said which in PHP is:
composer require mailchimp/transactional
I can ping, do all the simple requests without problem
but some options for events are not even avaliable, for example:
$options = new \MailchimpMarketing\Model\Events();
there is no 'Model' or Events in that namespace,
then of course I looked how this event is build in other languages and I give a try to pass parameters to the event like this:
$options = ["name" => "my-event-name", "properties" => ['PASSLINK' => 'test']];
$response = $mailchimp->lists->createListMemberEvent(
env('MC_AUDIENCE_ID'),
"somemember#gmail.com",
$options
);
200 status response, Event is trigger, mail received
but in the template used, nothing is passed:
I used in that template that event property like this:
*|EVENT:PASSLINK|*
also tried lowercase
*|EVENT:passlink|*
Same result
don't know what else to do
I had a similar issue. Seems that for a journey, the event property merge tag *|EVENT:PROPERTY|* does not work. They only work for classic automation. May be that is the issue.
Same issue here.
I tried all these combination of EVENT properties.
None of them works..
*|EVENT:name|*
*|EVENT:NAME|*
*|EVENT:PROPERTIES|*
*|EVENT:properties|*
*|EVENT:PROPERTIES:CODE|*
*|EVENT:properties:code|*
Related
My request looks like this
Array
(
[name] => Eugene A
[address] => Array
(
[billing] => Array
(
[address] => aaa
)
[shipping] => Array
(
[address] => bbb
)
)
)
I need to delete the shipping address. But how?
I can only delete both addresses,
$request->request->remove('address');
but I don't want it.
I want to delete only shipping address, like so
$request->request->remove('address.shipping');
But it is not working for me
Laravel 5.6
Update
Why do I need it?
Easy. I have abstracted out my Form Request validation into a class that is a child to Illuminate\Foundation\Http\FormRequest.
I actually have few classes for validation. I call them one by one in a controller like so:
app()->make(CustomerPostRequest::class); // validate Customer information
app()->make(AddressSaveRequest::class); // validate Addresses
Why?
Now I can Mock this requests in unit-tests, and I can have my validation abstracted out. And I can use Address validation in many places.
But Now I need more flexibility. Why?
Because AddressSaveRequest rule looks like this
public function rules(): array
{
return [
'address.*.address' => [
'bail',
'required',
'string',
],
...
It validates all addresses.
But sometimes I don't want to validate shipping address, if the the chech_box - ship_to_the_same_address is ticked.
But I have my Address validator abstracted in separate file and it is used in many places. There are places where ship_to_the_same_address tick box is not presented.
Thus I cannot use 'required_unless:ship_to_same_address,yes',
And I cannot use
app()->makeWith(AddressSaveRequest::class, ['ship_to_the_same_address ' => 'yes']);
Because Taylor said ...when calling makeWith. In my opinion it should make a new instance each time this method is called because the given parameter array is dynamic.. And it does, and it does not work correctly with app()->instance(AddressSaveRequest::class, $addressSaveRequest); and cannot be mocked in unit tests.
Why Taylor decided it - I seriously don't know.
PS
And yes, I know that mocking requests is not recommended.
If you were trying to add or remove inputs from the Request itself:
You can add data to the request pretty easily by merging it in and letting Laravel handle which data source is being used:
$request->merge(['input' => 'value']);
That will merge in the input named input into the input source for the Request.
For removing inputs you could try to replace all the inputs without that particular input in the replacement:
$request->replace($request->except('address.shipping'));
Just one idea to try.
Try this:
$request->except(['address.shipping']);
Details: Laravel Request
Laravel has a helper method called array_forget, which does exactly what it sounds like:
$requestArray = $request->all();
$newArray = array_forget($requestArray, 'address.shipping')
Documentation
After the edit to the main question with why some inputs of the request are to be deleted, my main answer isn't correct anymore. User Lagbox has the correct answer for the question that was asked.
However, I would like to note that another solution would be to have seperate Request classes with validation. One for placing an order (assuming it is a system where someone can order stuff) where ship_to_same_address is present and another one for things like updating your account, like PlaceOrderRequest and UpdateAccountRequest classes.
I am pretty new to Laravel. I am working on a REST api and was trying to look at the queries that were being generated from the models. In my routes I have a route group set up.
Route::(["before" => "auth", function()
{
Route::model("juror_subject", "JurorSubject");
Route::get("juror_subject", [
"as" => "juror_subject/index"
"uses" => "JurorSubjectController#index"
]);
});
I wanted to see what query was actually being run. I was watching a video by Jeffrey Way and he mentions that you can use Event::listen to see the query like so.
In routes:
Event::listen('laravel.query', function($sql){
var_dump($sql);
});
However, when I load the url:
localhost:8080/api/juror_subject
It returns the json response and never seems to fire the laravel.query event.
Am I missing some element that is needed to get event listeners to work properly? Is the type of routing I am using not firing a query? If so, how would I go about dumping the queries using a route group?
laravel.query is for Laravel 3 , use illuminate.query instead, also check this answer for more details.
Moreover, call DB::getQueryLog() to get all ran queries ( no need for listener), or use this package which is pretty neat.
Breeze's default validation messages use the database field name as part of the displayed error message; such as, "EmpTeleNo is required". Obviously, this probably shouldn't end up in the production version of our software.
But as we approach delivery of our software, it was hoped that this might be fixed, perhaps by inspecting the "Display" attribute from the model or something like that. As far as I can tell, this issue still remains.
Has this problem been resolved or has anyone figured out a work-around?
Thanks.
This is not YET well documented but you can simply set the 'displayName' property on any dataProperty and this will override the autogenerated display name and will be used for all validation messages for this property. So
var custType = myEntityManager.metadataStore.getEntityType("Customer");
var dp = custType.getProperty("companyName");
dp.displayName = "My custom display name";
Also, see the "Customize the message templates" topic at the bottom of this page: http://www.breezejs.com/documentation/validation.
There is also an item on the Breeze User Voice that requests something very similar to what you are asking for. Please vote for it.
https://breezejs.uservoice.com/forums/173093-breeze-feature-suggestions
I am trying to listen to the "catalog_product_save_before" and "catalog_product_save_after" events which are correctly triggered when I save individual product from admin interface.
But, these events are not triggered when I use the "update attributes" action for multiple product selections, from the product list grid. Is there any event which is triggered whenever a product attribute is updated ?? I know I need to write different observer function for csv upload but I need the event for grid action "Update attributes"..
Thanks in advance.
Cheers..
Got this to work out!!
I used this event : catalog_product_attribute_update_before
This give an array with changed attributes and product ids :
[attributes_data] => Array
(
[price_markup] => 10
)
[product_ids] => Array
(
[0] => 6
)
[store_id] => 0
Hope this helps ..
Cheers!!!
this might be a vague answer, I am not sure what you try to do with the attribute but maybe have a look into the Mage_Indexer module. Its bit more complex but it listens to all events or at least Magento takes care of notifying it if something is outdated or has changed.
And also if something goes funky with your data, rerunning your indexer should clean up all the data in an ideal world.
I am using CHtml::checkBoxList for my form. For some reason I cannot use CHtml:activeCheckBoxList or CActiveForm::checkBoxList. Everything works fine only problem is that I loose checkbox values on form validation error. What could be the easiest way to fix this ?
If you're making a form, you probably want to use CActiveForm's checkboxlist, which is a form-specific wrapper of CHtml::activeCheckBoxList) instead. Something like
echo $form->checkBoxList(
$model,
'condiments',
array(
'ketchup'=>'Ketchup',
'mustard'=>'Mustard',
'relish'=>'Relish',
'onions'=>'Onions'
)
);
should give you a persistent check box list of hot dog condiments, for example.