This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Transactional; | |
use Illuminate\{ | |
Database\DatabaseManager, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmailManager | |
{ | |
public function confirmEmail(User $user): User | |
{ | |
$user = \DB::transaction(function () use ($user) { | |
$user = User::lockForUpdate()->findOrFail($user->id); | |
$user->email_confirmed = true; | |
$user->save(); | |
event(new UserErmailConfiming($user)); // DO some operations inside transactions (i.e. log user actions to DB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, PropTypes } from 'react'; | |
class FormClass extends Component { | |
static propTypes = { | |
onSubmit: PropTypes.func.isRequired, | |
setRef: PropTypes.func, | |
}; | |
constructor(props) { | |
super(props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- select all query -- | |
SELECT b.bookTitle, a.authorName FROM book b | |
INNER JOIN author_book ab ON ab.bookID = b.bookID | |
INNER JOIN author a ON a.authorID = ab.authorID | |
ORDER BY b.bookTitle | |
-- select all with authors concantenated -- | |
SELECT b.bookTitle, GROUP_CONCAT(a.authorName) authors FROM book b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Ramsey\Uuid\Uuid; | |
class Manager | |
{ | |
const DEFAULT_CONSUME_TIMEOUT = 12 * 60 * 60; | |
const DEFAULT_BLPOP_INTERVAL = 30; | |
/** @var \Redis */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace models\Instant\Action; | |
interface ActionInterface | |
{ | |
/** | |
* Executes action | |
* | |
* @param array $args |