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 Tests\Feature; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
use App\Mail\WelcomeNewCustomer; | |
use Illuminate\Support\Facades\Mail; |
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\Models; | |
use App\Observers\CustomerObserver; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Database\Eloquent\SoftDeletes; | |
class Customer extends Model | |
{ |
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\Observers; | |
use App\Mail\WelcomeNewCustomer; | |
use App\Models\Customer; | |
use Illuminate\Support\Facades\Mail; |
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\Http\Controllers; | |
use App\Models\Customer; | |
use App\Http\Requests\NewCustomerRequest; | |
class CustomerController extends Controller |
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
This is the request validadtion code for post route | |
https://gist.github.com/Faizanq/3d2b435b7c61fa37f28feb74ddef2daa | |
Customer Controller Code | |
https://gist.github.com/Faizanq/f7096495a66080e15c31d6ea55e98b7a | |
Customer mail observer which is responsible for mail sending | |
https://gist.github.com/Faizanq/60fd21b3f4c4ee71876fbe2429d5295d | |
Customer model where we injecting observer for create event |
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\Http\Requests; | |
use Illuminate\Foundation\Http\FormRequest; | |
class NewCustomerRequest extends FormRequest | |
{ | |
/** | |
* Determine if the user is authorized to make this request. |
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
<template> | |
<div class="widget"> | |
<div v-if="activeItems && activeItems.length > 0"> | |
<ul> | |
<li v-for="item in activeItems" :key="item.id"> | |
{{item.name}} | |
</li> | |
</ul> | |
</div> | |
</div> |
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
# 7.4 | |
sudo apt-get -y install php-pear php7.4-dev | |
sudo update-alternatives --set php /usr/bin/php7.4 | |
sudo update-alternatives --set phar /usr/bin/phar7.4 | |
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4 | |
sudo update-alternatives --set phpize /usr/bin/phpize7.4 | |
sudo update-alternatives --set php-config /usr/bin/php-config7.4 | |
sudo pecl uninstall -r sqlsrv |
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 TimeoutClass extends Thread { | |
public function __construct(callable $cb, int $time, $args){ | |
$this->callback = $cb; | |
$this->args = $args; | |
$this->time = $time * 1000; | |
} | |
public function run(){ | |
usleep($this->time); |
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
// Generate unique IDs for use as pseudo-private/protected names. | |
// Similar in concept to | |
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>. | |
// | |
// The goals of this function are twofold: | |
// | |
// * Provide a way to generate a string guaranteed to be unique when compared | |
// to other strings generated by this function. | |
// * Make the string complex enough that it is highly unlikely to be | |
// accidentally duplicated by hand (this is key if you're using `ID` |
NewerOlder