當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。