filamentphp 通过中间件设置 
                                                    
                        
                    
                    
  
                    
                    
引入官方配置插件
setting
创建配置页面参看官网文档
中间件设置
class HandeFilamentSettings
{
    public function __construct(
        protected GeneralSetting $settings
    ) {
    }
    /**
     * Handle an incoming request.
     *
     * @param  \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        FilamentColor::register([
            'primary' => $this->settings->theme_color,
        ]);
        Table::$defaultDateDisplayFormat = $this->settings->date_format;
        Table::$defaultTimeDisplayFormat = $this->settings->time_format;
        Table::$defaultDateTimeDisplayFormat = $this->settings->datetime_format;
        config([
            'app.name' => $this->settings->company_name,
        ]);
        return $next($request);
    }
}
本作品采用《CC 协议》,转载必须注明作者和本文链接
 
           Mumujin 的个人博客
 Mumujin 的个人博客
         
                     
                     
           
           关于 LearnKu
                关于 LearnKu
               
                     
                     
                     粤公网安备 44030502004330号
 粤公网安备 44030502004330号 
 
推荐文章: