Inheritance: extends Plank\Mediable\Exceptions\MediaUploadException
 public function test_it_returns_a_403_for_dissalowed_disk()
 {
     $e = (new SampleExceptionHandler())->render(ForbiddenException::diskNotAllowed('foo'));
     $this->assertHttpException($e, 403);
 }
Exemplo n.º 2
0
 /**
  * Ensure that the provided filesystem disk name exists and is allowed.
  * @param  string $disk
  * @return string
  * @throws \Plank\Mediable\Exceptions\MediaUpload\ConfigurationException If the disk does not exist
  * @throws \Plank\Mediable\Exceptions\MediaUpload\ForbiddenException If the disk is not included in the `allowed_disks` config.
  */
 private function verifyDisk($disk)
 {
     if (!array_key_exists($disk, config('filesystems.disks'))) {
         throw ConfigurationException::diskNotFound($disk);
     }
     if (!in_array($disk, $this->config['allowed_disks'])) {
         throw ForbiddenException::diskNotAllowed($disk);
     }
     return $disk;
 }