$max = -1; } else { $max = \Config::get('vanemart::post.add.max_attaching_files', 10); } $attached = $options['post']->attach('attach', $max, $block->user()); $models = array_merge($models, $attached); } }); // Fired after successfully adding a post with attachments and all required database // and other changes. // //* $options hash - the same as in post.attach plus 'attachments' hash of File. Event::listen(VANE_NS . 'post.added', function (array $options) { extract($options, EXTR_SKIP); $poster = $block->user(false); $to = User::all(arrize(\Vane\Current::config('general.post_notify_users'))); if ($type === 'order' and $order = Order::find($object)) { foreach (array('user', 'manager') as $field) { $to[] = $order->{$field}()->first(); } } foreach ($to as $recipient) { if (!$poster or $poster->email != $recipient->email) { \Vane\Mail::sendTo($recipient->emailRecipient(), 'vanemart::mail.order.post', array('order' => $order->to_array(), 'user' => $block->user()->to_array(), 'recipient' => $recipient->to_array(), 'post' => $post->to_array(), 'files' => func('to_array', $attachments))); } } }); // Fired after post.added if post is attached to an object. // //* $object Eloquent //* $options hash - the same as in post.added.