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 User { | |
protected $firstName; | |
protected $lastName; | |
protected $email; | |
public function setFirstName(string $firstName): self | |
{ |
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
To Add a lot | |
POST base_url/sellers/{seller_id}/lots/create | |
Request Body | |
{ | |
weight:float|min_weight:500, | |
country_of_origin:string or id (if list of country db exiss and is seeded), | |
harvest_date:date_time, | |
cultivar: string | |
} |
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
//BaseTest.php file name (same convention is followed) | |
<?php | |
use PHPUnit\Framework\TestCase; | |
include'./Hero.php'; // i utilized includes to be swift | |
class BaseTest extends TestCase | |
{ | |
public $defender; |
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 | |
$numbers = []; | |
foreach(range(1,10) as $index){ | |
$newAddition = mt_rand(1, 100000); | |
while(in_array($newAddition, $numbers)){ | |
$newAddition = mt_rand(1, 100000); | |
} |
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 | |
//With exceptions | |
try { | |
$model->name = "Elisha"; | |
$model->save(); | |
} catch(ModelFailedToSaveException $e){ |
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 | |
$name = 'Elisha'; | |
function sayNameInCapital($name){ | |
echo capitalizeText($name); | |
} | |
function capitalizeText($text){ |
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 OOPExample | |
{ | |
public function __construct($name) | |
{ | |
$this->name = $name; | |
} | |
public function sayName(){ | |
echo $this->name; | |
} |
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
/** BEFORE DRY */ | |
<a href="{{route(sprintf('%s.templateLibrary.index', app()->getLocale()))}">Hello</a> | |
<a href="{{route(sprintf('%s.templateLibrary.index', app()->getLocale()))}">Hello 2</a> | |
<a href="{{route(sprintf('%s.templateLibrary.index', app()->getLocale()))}">Hello 3</a> | |
/** AFTER DRY */ | |
function getRouteString($route){ | |
return route(sprintf("%s.{$route}", app()->getLocale())); | |
} |
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
const targetNode = document.querySelector('.cff-wrapper-ctn'); | |
const config = { childList: true, subtree: true }; | |
function addBorder(){ | |
const posts = Array.from(document.getElementsByClassName('cff-item')); | |
posts.forEach(post =>{ | |
let count = parseInt(post.getElementsByClassName('cff-count')[0].innerHTML); | |
if(count >= 3){ | |
post.style.border = '1px solid black'; |
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 App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Aws\S3\S3Client; | |
use League\Flysystem\AwsS3v3\AwsS3Adapter; | |
use League\Flysystem\Filesystem; | |
use Storage; |