承接 dialect/saasify 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dialect/saasify

Composer 安装命令:

composer require dialect/saasify

包简介

Saas support for laravel models

README 文档

README

Build Status

saasify

Saasify helps package models into modules for easier SAAS-management. Modules then gets attached to plans. This makes it possible to check if a user with a specific plan are able to access a model.

Install

TODO

Usage

Components

Plan

Variables
name, price
Relations
modules

 

Module

Variables
name
Relations
plans, models

Model

Variables
model, module, canCreate, canUpdate, canDelete, maxCount
Relations
module

Examples

 ## Save / Update ##
 
  //You can use the saasify-helper to create components
  $plan = saasify()->plan();
  $model = saasify()->module();
  $model = saasify()->plan();
  
  //Change the variables using the helper methods
  $model = saasify()->model()->setModel(\App\Model::class)->setMaxCount(100);
  
  //Use the save-method to save or update a component
  $plan = saasify()->plan()->setName('foo')->save();
  
  //use the delete-function to remove component
  $plan->delete();
  
  ## Retrieve component ##
  
   $module = saasify()->modules()->find('foobar');
   $modules = saasify()->modules()->all();
   
   //It's also possible to use queries
   $plans = saasify()->plans(function($query){
      return $query->where('price', '>', 10);
   })->get();
   
   //The component-builders also supports
   saasify()->modules()->count();
   saasify()->modules()->first();
   
  
  ## Relations ##
  
   //to add a relaiton use the add-method
   $plan = saasify()->plan()->setName('foo')->save();
   $module = saasify()->module()->setName('bar')->save();
   $plan->addModule($module);
   
   //or remove using the remove-method
   $plan->removeModule($module)
  
   //As of now, you need to set the module on a model before its saved.
   $model = saasify()->model()
                     ->setModel(\App\Model::class)
                     ->setModule($module);
                     
                     
  ## Access ## 
  
  //Add the trait HasPlans to the Laravel model that should have plans
  class User extends Model{
	   use HasPlans;
  }
  
  //this gives acceess to new method
  $user->canAccess(FooBar::class);
  $user->canAccess($fooBar);
  $user->canUpdate(..);
  $user->canDelete(..);
  $user->getCount(..);
  
  //for saasify to know how many instances of a model a user has,
  //add the saasify helper method to the model with the required logic for counting.
  class User extends Model{
	  public static function saasifyCurrent($user){
	    //logic here, example:
	    return $user->foobar()->count();
	  }
  }
  
  

License

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

统计信息

  • 总下载量: 31
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固