All Projects → isaeken → laravel-theme-system

isaeken / laravel-theme-system

Licence: MIT license
Theme system for Laravel Framework.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-theme-system

System Design Primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
Stars: ✭ 154,659 (+217729.58%)
Mutual labels:  system
Sage9-Woocommerce-Integration
How to use Woocommerce (3.4.3) with Sage 9.0.1 (Blade + SoberWP controllers), WP 4.9.7 (17/07/2018)
Stars: ✭ 26 (-63.38%)
Mutual labels:  blade
blade
🏃 A library for using Laravel Blade templates in WordPlate.
Stars: ✭ 28 (-60.56%)
Mutual labels:  blade
OpenESS
KETI Data Platform : OpenESS(Energy Storage System)
Stars: ✭ 19 (-73.24%)
Mutual labels:  system
movie-app
🌈 TMDB + Laravel + LiveWire + AlpineJS + ViewModels + Components = ❤️ Movies App 🔥
Stars: ✭ 43 (-39.44%)
Mutual labels:  blade
entitas-python
Entitas ECS implementation in Python.
Stars: ✭ 41 (-42.25%)
Mutual labels:  system
Ros robotics projects
Example codes of new book ROS Robotics Projects
Stars: ✭ 240 (+238.03%)
Mutual labels:  system
InitWare
The InitWare Suite of Middleware allows you to manage services and system resources as logical entities called units. Its main component is a service management ("init") system.
Stars: ✭ 164 (+130.99%)
Mutual labels:  system
yaf
Yet another system fetch that is minimal and customizable
Stars: ✭ 23 (-67.61%)
Mutual labels:  system
hardware
Get CPU, Memory and Network informations of the running OS and its processes
Stars: ✭ 70 (-1.41%)
Mutual labels:  system
Entia
Entia is a free, open-source, data-oriented, highly performant, parallelizable and extensible Entity-Component-System (ECS) framework written in C# especially for game development.
Stars: ✭ 28 (-60.56%)
Mutual labels:  system
x-blade-components
Laravel Blade Components ready to use
Stars: ✭ 36 (-49.3%)
Mutual labels:  blade
VAOS
Virtual Aviation Operations System
Stars: ✭ 44 (-38.03%)
Mutual labels:  system
geekbb
😎 Geek dev club.
Stars: ✭ 26 (-63.38%)
Mutual labels:  blade
monitor
mac 实时网速监控 bandwidh monitor
Stars: ✭ 23 (-67.61%)
Mutual labels:  system
Javaguide
「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,首选 JavaGuide!
Stars: ✭ 114,707 (+161459.15%)
Mutual labels:  system
gatsby-remark-design-system-example
Example page for "gatsby-remark-design-system"
Stars: ✭ 13 (-81.69%)
Mutual labels:  system
ltest
A Testing Framework for LFE (successor to lfeunit)
Stars: ✭ 31 (-56.34%)
Mutual labels:  system
blade-jdbc
🐜 move to https://github.com/biezhi/anima
Stars: ✭ 36 (-49.3%)
Mutual labels:  blade
online exam system
基于SSM的在线考试系统
Stars: ✭ 98 (+38.03%)
Mutual labels:  system

Laravel Theme System

Laravel Theme System

Latest Version CircleCI GitHub Code Style Action Status Total Downloads

Installation and setup

Installation

You can install the package via composer:

composer require isaeken/laravel-theme-system

Setup

You can publish the config file with:

php artisan vendor:publish --provider="IsaEken\ThemeSystem\ThemeSystemServiceProvider" --tag="theme-system-config" --tag="theme-system-migrations"
php artisan migrate

Run the following command in the terminal for initializing:

php artisan themes:init

Usage

Change the theme in runtime

theme_system()->setTheme('your-theme-name');

Get current theme name

theme_system()->getCurrentTheme();

Set theme per user

// \App\Models\User.php
class User extends Authenticatable
{
    use \IsaEken\ThemeSystem\Traits\CanChooseTheme; // Add this
    
    // ...
}
// In your controller or middleware
auth()->user()->theme; // theme for user.
auth()->user()->theme = 'default'; // theme is saved to db.

auth()->user()->themeApply(); // changed current theme to user theme.

Creating theme

Run the following command in the terminal.

php artisan make:theme your-theme-name

Change theme in PHP or application config.

Webpack

Do not change the main webpack.mix.js file.

A special "webpack.mix.js" file is created for each theme.

The "webpack.mix.js" file of the default theme is in the "resources" folder.

You can continue to use the "webpack.mix.js" as normal in the default theme.

However, in themes you should use it as in the example.

const mix = require('laravel-mix');

mix
    .js(themeResourceRoot + '/js/app.js', 'js')
    .postCss(themeResourceRoot + '/css/app.css', 'css', [
        //
    ]);

exports.mix = mix;

Middleware to set a theme

Register ThemeMiddleware in app\Http\Kernel.php:

protected $routeMiddleware = [
    // ...
    'theme' => \IsaEken\ThemeSystem\Http\Middlewares\ThemeMiddleware::class,
];

Example usages:

Route::group(['middleware' => 'theme:your-theme-name'], function () {
    // ...
});

Route::get('/hello-world', fn () => 'Hello World!')->middleware('theme:your-theme-name');

If you need to advanced methods, see ThemeSystem class.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].