Skip to content

Global forms permission for new forms #4755

Answered by duncanmcclean
Kylewalow asked this question in Q&A
Discussion options

You must be logged in to vote

This can be done with a little bit of extra code, here's what I did earlier:

  1. Create a file (you can change it later): app/Listeners/AddFormPermissionsToAdminRole.php
<?php

namespace App\Listeners;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Statamic\Events\FormSaved;
use Statamic\Facades\Role;

class AddFormPermissionsToAdminRole
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  object  $event
     * @return void
     */
    public function handle(FormSaved $event)
    {
        $adminRole = Role::find('

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Kylewalow
Comment options

@duncanmcclean
Comment options

Answer selected by Kylewalow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants