当前位置: 首页>>代码示例>>PHP>>正文


PHP static::raise方法代码示例

本文整理汇总了PHP中static::raise方法的典型用法代码示例。如果您正苦于以下问题:PHP static::raise方法的具体用法?PHP static::raise怎么用?PHP static::raise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


在下文中一共展示了static::raise方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Roles themselves don't require any fields to create the records - but they do need a record. The name
  * translations are handled within the business rules of the translations.
  *
  * @return static
  */
 public static function create(array $attributes)
 {
     $role = new static();
     $role->default = $attributes['default'];
     $role->raise(new RoleWasCreated($role));
     return $role;
 }
开发者ID:kamaroly,项目名称:shift,代码行数:13,代码来源:Role.php

示例2: createToken

 /**
  * Create an account switch token
  *
  * @param \Tectonic\Shift\Library\Tokens\TokenGeneratorInterface $tokenGenerator
  *
  * @return static
  */
 public static function createToken(TokenGeneratorInterface $tokenGenerator)
 {
     $token = new static();
     $token->token = $tokenGenerator->generateToken();
     $token->data = $tokenGenerator->encodeData();
     $token->raise(new TokenWasGenerated($token));
     return $token;
 }
开发者ID:kamaroly,项目名称:shift,代码行数:15,代码来源:Token.php

示例3: register

 public static function register($username, $email, $password)
 {
     //in eloquent, when you pass params to instantiate an object
     //you need to pass it through as an array
     $user = new static(compact('username', 'email', 'password'));
     $user->raise(new UserRegistered($user));
     return $user;
 }
开发者ID:rwaithera,项目名称:larabook,代码行数:8,代码来源:User.php

示例4: post

 /**
  * Stores a new blog into database.
  *
  * @param [type] $title       [description]
  * @param [type] $description [description]
  *
  * @return Blog [description]
  */
 public static function post($title, $description)
 {
     $blog = new static();
     $blog->title = $title;
     $blog->description = $description;
     $blog->save();
     $blog->raise(new BlogWasPosted($blog));
     return $blog;
 }
开发者ID:noddypandey,项目名称:basicangular,代码行数:17,代码来源:Blog.php

示例5: register

 /**
  * Register a user
  *
  * @param $username
  * @param $email
  * @param $password
  * @return static
  */
 public static function register($username, $email, $password = false)
 {
     if (!$password) {
         $password = 'ch@ng3m3';
     }
     $user = new static(compact('username', 'email', 'password'));
     $user->raise(new UserRegistered($user));
     return $user;
 }
开发者ID:tattedweazel,项目名称:tob_v2,代码行数:17,代码来源:User.php

示例6: start

 /**
  * Create a new instance.
  *
  * @param  string  $title
  * @param  \Flarum\Core\Models\User  $user
  * @return static
  */
 public static function start($title, $user)
 {
     $discussion = new static();
     $discussion->title = $title;
     $discussion->start_time = time();
     $discussion->start_user_id = $user->id;
     $discussion->raise(new DiscussionWasStarted($discussion));
     return $discussion;
 }
开发者ID:Qiang1234,项目名称:core,代码行数:16,代码来源:Discussion.php

示例7: createNew

 /**
  * Create a game
  *
  * @param $name
  * @param $players
  * @param $private
  * @param $password
  * @internal param $gamename
  * @internal param $email
  * @return static
  */
 public static function createNew($name, $max_players, $private, $password, $user_id)
 {
     if ($private) {
         $game = new static(compact('name', 'max_players', 'private', 'password', 'user_id'));
     } else {
         $game = new static(compact('name', 'max_players', 'user_id'));
     }
     $game->raise(new GameCreated($game));
     return $game;
 }
开发者ID:tattedweazel,项目名称:tob_v2,代码行数:21,代码来源:Game.php

示例8: add

 /**
  * Add a new permission object.
  *
  * @param Role $role
  * @param string $resource
  * @param string $action
  * @param Mode $mode
  * @return Permission
  */
 public static function add(Role $role, $resource, $action, Mode $mode)
 {
     $permission = new static();
     $permission->roleId = $role->id;
     $permission->resource = $resource;
     $permission->action = $action;
     $permission->mode = $mode;
     $permission->raise(new PermissionWasAdded($permission));
     return $permission;
 }
开发者ID:kamaroly,项目名称:shift,代码行数:19,代码来源:Permission.php

示例9: build

 /**
  * Create a new group.
  *
  * @param string $nameSingular
  * @param string $namePlural
  * @param string $color
  * @param string $icon
  * @return static
  */
 public static function build($nameSingular, $namePlural, $color, $icon)
 {
     $group = new static();
     $group->name_singular = $nameSingular;
     $group->name_plural = $namePlural;
     $group->color = $color;
     $group->icon = $icon;
     $group->raise(new GroupWasCreated($group));
     return $group;
 }
开发者ID:asifalimd,项目名称:core,代码行数:19,代码来源:Group.php

示例10: register

 /**
  * Register a new user.
  *
  * @param  string  $username
  * @param  string  $email
  * @param  string  $password
  * @return static
  */
 public static function register($username, $email, $password)
 {
     $user = new static();
     $user->username = $username;
     $user->email = $email;
     $user->password = $password;
     $user->join_time = time();
     $user->raise(new UserWasRegistered($user));
     return $user;
 }
开发者ID:Qiang1234,项目名称:core,代码行数:18,代码来源:User.php

示例11: register

 /**
  * [register description]
  * @param  [type] $username [description]
  * @param  [type] $email    [description]
  * @param  [type] $password [description]
  * @return [type]           [description]
  */
 public static function register($username, $email, $password)
 {
     $user = new static(compact('username', 'email', 'password'));
     $path = public_path();
     $parentDir = $path . '/img/users/' . $email . '/';
     if (!file_exists($parentDir)) {
         mkdir($parentDir, 0777, true);
     }
     $user->raise(new UserRegistered($user));
     return $user;
 }
开发者ID:prateekk16,项目名称:Pluto,代码行数:18,代码来源:User.php

示例12: reply

 /**
  * Create a new instance in reply to a discussion.
  *
  * @param  int  $discussionId
  * @param  string  $content
  * @param  int  $userId
  * @return static
  */
 public static function reply($discussionId, $content, $userId)
 {
     $post = new static();
     $post->content = $content;
     $post->time = time();
     $post->discussion_id = $discussionId;
     $post->user_id = $userId;
     $post->type = 'comment';
     $post->raise(new PostWasPosted($post));
     return $post;
 }
开发者ID:Qiang1234,项目名称:core,代码行数:19,代码来源:CommentPost.php

示例13: reply

 /**
  * Create a new instance in reply to a discussion.
  *
  * @param int $discussionId
  * @param string $content
  * @param int $userId
  * @return static
  */
 public static function reply($discussionId, $content, $userId)
 {
     $post = new static();
     $post->time = time();
     $post->discussion_id = $discussionId;
     $post->user_id = $userId;
     $post->type = static::$type;
     // Set content last, as the parsing may rely on other post attributes.
     $post->content = $content;
     $post->raise(new PostWasPosted($post));
     return $post;
 }
开发者ID:huytd,项目名称:core,代码行数:20,代码来源:CommentPost.php

示例14: savePageOrThrowException

 public function savePageOrThrowException($title, $slug = null, $content, $template)
 {
     $slug = $this->createSlug($slug, $title);
     $page = new static();
     $page->title = $title;
     $page->content = $content;
     $page->template = $template;
     $page->author()->associate(\Auth::user());
     if ($page->save()) {
         $page->raise(new PageWasPublished($page, $slug));
     }
     return $page;
 }
开发者ID:voltcms,项目名称:pages,代码行数:13,代码来源:Page.php

示例15: publish

 /**
  * Publish a new status
  * @param  [type] $body [description]
  * @return [type]       [description]
  */
 public static function publish($user_id, $body, $global)
 {
     $body = Crypt::encrypt($body);
     $message = new static(compact('user_id', 'body', 'global'));
     $message->raise(new GlobalMessagePublished($user_id, $body));
     return $message;
 }
开发者ID:prateekk16,项目名称:Pluto,代码行数:12,代码来源:Message.php


注:本文中的static::raise方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。