DELIMITER $$
CREATE TRIGGER Prevent_User_From_Insert_Empty_Strings BEFORE INSERT ON users
FOR EACH ROW
BEGIN
IF NEW.name = '' THEN
SIGNAL SQLSTATE '45000';
END IF;
END;
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 | |
class Author | |
{ | |
private $id, $membership, $posts = []; | |
// Pseudo code 1 | |
public function __construct($id, $membership, $posts) |
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 | |
/** | |
* A better way to iterate over an collection | |
*/ | |
$itemsArray = [ 1, 2, 3 ]; | |
/** | |
* Legacy code |
File: tests/TestCase.php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
This code snippet overrides php DuskTestCase->createBrowsers
method to extends the functionality and add the elements count assertion
File tests/Browser/BaseBrowser.php
// Extend Browser Class
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use PHPUnit_Framework_Assert as PHPUnit;
File: index.php
class Article
{
private $title = "This is an article";
}
umask (002)
0 0 2 = 000 000 010
Not 0 0 2 = 111 111 101
110 110 110 AND
111 111 101 =
110 110 100
rw- rw- r--
############
umask (022)
<?php
class CacheDecorater
{
function decorate( $tweet )
{
$tweet->cached = true;
return $tweet;
}
<?php
class AuthGuard
{
public static function guard()
{
use Illuminate\Http\JsonResponse;
class JsonEmptyResponse extends JsonResponse
{
public function __construct()
{
$data = [
OlderNewer