JReviews logo Docs
Menu
Version

listingresources:permission:resource.create

Allows filtering whether a user can create a resource for a listing. Resources allow adding downloadable files, documents, videos, or links to listings.

Filter
Listing Resources
Since 6.0.0

You need to have a working knowledge of Hooks before you get started.

Fires when checking if user can add a resource to a listing, before resource creation form is shown

Parameters

Name Type Description
$canCreateResource bool Whether user can create a resource (default based on configuration and limits)
$user \JReviews\App\Models\User The user attempting to create the resource
$listing \JReviews\App\Models\Listing The listing the resource would be added to
$resourceTypeId int|null The resource type ID if specified

Boilerplate Code

Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.

fwd_add_filter('listingresources:permission:resource.create', function($canCreateResource, $user, $listing, $resourceTypeId)
{
    // Your code here
    
    return $canCreateResource;
});
Development & Support
Customizations are not included with support. We provide this information to make it easier for developers to extend the functionality. From time to time we may have some availability for custom work. Get in touch to see if there's an opportunity to work together.

Source Files

  • app/Policies/ListingResourcePolicy.php