This file contains hidden or 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
'phone_number' => "required|unique:users,phone_number,$id|min:10|max:20", | |
protected function prepareForValidation() | |
{ | |
$this->offsetSet('phone_number', PhoneHelper::normalize($this->phone_number)); | |
} | |
<?php |
This file contains hidden or 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 Cupon extends Model | |
{ | |
/** | |
* Получить продукт где купон id связан. | |
*/ | |
public function product() | |
{ | |
return $this->belongsTo('App\Product'); | |
} | |
} |
This file contains hidden or 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
Terminal | |
если нужно найти недавно выполненную команду в истории, но помните только часть | |
`history | grep console` где `console` искомое слово, | |
выведет нумерованный список команд, находите нужную и запускаете ее по номеру `!541` | |
Symfony Console | |
если кому лень настраивать автокомплит команд для симфони, можно просто не писать полные команды, например | |
`bin/console c:c` равносильно `bin/console cache:clear`, | |
а `bin/console d:d:c` равносильно `bin/console doctrine:database:create`, |
This file contains hidden or 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 | |
class Booked extends \yii\db\ActiveRecord | |
{ | |
/** @var $sum integer */ | |
public $sum; | |
/** @var $countBookedRoom integer */ | |
public $countBookedRoom; | |
/** @var $countPayment integer */ | |
public $countPayment; | |
/** @var $numberRoom integer */ |
This file contains hidden or 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 | |
/** example */ | |
$text = function (string $text) { | |
return $text; | |
}; | |
$text('hello'); //return hello | |
$text = 'sum = '; | |
//в use можно передать несколько переменных function() use($var1, $var2) { } |
This file contains hidden or 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 | |
class A | |
{ | |
static public $name = 'zir4onah'; | |
static public function name() | |
{ | |
return static::$name; |
This file contains hidden or 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 app\modules\admin\models; | |
use yii\db\ActiveRecord; | |
class Active extends ActiveRecord | |
{ | |
public static function getDb() | |
{ |
This file contains hidden or 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 | |
final class Palindrome | |
{ | |
/** @var string $string */ | |
private $string; | |
/** @var string $oneLongString */ | |
private $oneLongString; |
This file contains hidden or 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 | |
abstract class Animal | |
{ | |
/** | |
* @var Animal|string $name | |
*/ | |
protected $name; | |
/** |
NewerOlder