本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}