# Transitions

todo

# Notify

This transition option allows you to send notification to material creator when transition is triggered. Notification message will be required from the user once the transition is triggered.

Here is the example for setting notify option on transition that moves material back to briefing:
























 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 





<?php

use App\Models\File;
use App\Models\Material;

// CLIENT_CONFIG/transitions.php

return [

  // ...

  'revise_material' => [
    'actionLabel'    => 'Revise Material',
    'buttonLabel'    => 'Revise Material',
    'successMessage' => 'We unlocked the Material for you – feel free to edit it.',
    'filter'         => [
      'status' => 'in_review',
    ],
    'updates'        => [
      'status' => 'briefing'
    ],
    'headline'       => 'Revise Material',
    'description'    => 'You are about to return the material to the briefing...',
    'notify'         => [
      'data'       => static function (Material $material) {
        $materialId = $material->getKey();

        // let's get all attached FileBox uploaded files of the Material
        $attachedMaterialFiles = File::getAllGoogleCloudBucketStoredFiles($materialId)
          ->where('sc2_file_type', File::TYPE_FILEBOX_UPLOAD)
          ->map(static function (File $file) {
            return [
              'name' => $file->client_file_name,
              // Relating the usage of Carbon here
              // search for "signed URLs" for the basic understanding
              // (and our default hard retention period is 3 years)
              'url'  => $file->getFilePointer()->getDownloadUrl(Carbon::now()->addYears(3))
            ];
          })
          ->toArray();

        return [
          // we add the files to the array we return which will then
          // be added as `$files` variable in the client's
          // `custom-notification` notification (mail)
          'files' => $attachedMaterialFiles,
        ];
      },
      'renditions' => [
        MaterialRendition::RENDITION_BRIEFING_PDF,
        MaterialRendition::RENDITION_LIVE_PDF
      ],
      'required'   => false,
      'subject'    => static function (Material $material) {
        return "Material $material->name ($material->id) requires your attention";
      },
      'template'   => 'custom-notification',
    ]
  ],

  // ...

];

# Options

Name Description
data You can add custom payloads to such a notification email, like file attachments, but not only that. Based on our example above, we can now use $files in the used notification custom-notification.
renditions Renditions to be used in the e-mail notifications
required If set to true notification will always be required on transition, else it will be optional
subject Subject that will be used in the e-mail notification
template Template that will be used for the e-mail notification