Skip to content
Snippets Groups Projects
PageModel.php 1.61 KiB
Newer Older
  • Learn to ignore specific revisions
  • /**
     * @copyright  2020 Podlibre
     * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
     * @link       https://castopod.org/
     */
    
    namespace App\Models;
    
    
        protected $allowedFields = ['id', 'title', 'slug', 'content_markdown', 'content_html'];
    
        protected $validationRules = [
            'title' => 'required',
            'slug' =>
    
                'required|regex_match[/^[a-zA-Z0-9\-]{1,191}$/]|is_unique[pages.slug,id,{id}]',
    
            'content_markdown' => 'required',
    
    
        /**
         * Before update because slug or title might change
         *
         * @var string[]
         */
    
         * @return array<string, array<string|int, mixed>>
         */
        protected function clearCache(array $data): array
    
            // Clear the cache of all pages