Compare commits
5 Commits
625dfeb79f
...
e78324e92a
Author | SHA1 | Date | |
---|---|---|---|
e78324e92a | |||
5ceb315b6c | |||
58a4701ba3 | |||
a1f677ff9b | |||
ebb6a4721a |
125
src/app/Observers/UserObserver.php
Normal file
125
src/app/Observers/UserObserver.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class UserObserver
|
||||
{
|
||||
/**
|
||||
* Handle events after all transactions are committed.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $afterCommit = true;
|
||||
|
||||
/**
|
||||
* Handle the User "retrieve" event.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function retrieved(User $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the User "saving" event.
|
||||
* This may apply as either a create
|
||||
* or an update event.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function saving(User $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the User "created" event.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function created(User $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the User "updated" event.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updated(User $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the User "deleted" event.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleted(User $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the User "restored" event.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function restored(User $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the User "forceDeleted" event.
|
||||
*
|
||||
* @package App\Observers\UserObserver
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function forceDeleted(User $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -17,11 +17,15 @@
|
||||
"spatie/laravel-permission": "",
|
||||
"zizaco/entrust": "",
|
||||
|
||||
// Options/Flags
|
||||
"spatie/laravel-model-flags": "", // add a simple true/false flag to any model
|
||||
|
||||
// SDKs
|
||||
"aws/aws-sdk-php-laravel": "", // interact with S3 or S3-compatible storage
|
||||
"propaganistas/laravel-phone": "", // uses Google's libphonenumber API to (try to) sanely handle phone numbers
|
||||
"vladimir-yuldashev/laravel-queue-rabbitmq": "", // Interface with RabbitMQ servers
|
||||
"grimzy/laravel-mysql-spatial": "", // Adds Geo-spatial column support for MySQL
|
||||
"grimzy/laravel-mysql-spatial": "", // Adds Geo-spatial column support for MySQL (WARNING: only works with Laravel v8 or lower)
|
||||
"matanyadaev/laravel-eloquent-spatial": "", // Adds Geo-spatial column support for MySQL
|
||||
"irazasyed/telegram-bot-sdk": "", // unofficial Telegram Bot API/SDK
|
||||
"torann/geoip": "", // support for multiple GeoIP services
|
||||
"coderjerk/nasa-php": "", // NASA API integrations
|
||||
|
@ -65,6 +65,53 @@ if (! function_exists('carbon')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('translations')) {
|
||||
/**
|
||||
* Loads translations from a JSON file.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $jsonFilePath
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function translations(string $jsonFilePath): array
|
||||
{
|
||||
if (! file_exists($jsonFilePath)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$payload = [];
|
||||
$jsonData = json_decode(file_get_contents($jsonFilePath), true);
|
||||
|
||||
switch (json_last_error()) {
|
||||
case JSON_ERROR_NONE:
|
||||
$payload = $jsonData;
|
||||
break;
|
||||
case JSON_ERROR_DEPTH:
|
||||
throw new \Exception('Maximum stack depth exceeded');
|
||||
break;
|
||||
case JSON_ERROR_STATE_MISMATCH:
|
||||
throw new \Exception('Underflow or the modes mismatch');
|
||||
break;
|
||||
case JSON_ERROR_CTRL_CHAR:
|
||||
throw new \Exception('Unexpected control character found');
|
||||
break;
|
||||
case JSON_ERROR_SYNTAX:
|
||||
throw new \Exception('Syntax error, malformed JSON');
|
||||
break;
|
||||
case JSON_ERROR_UTF8:
|
||||
throw new \Exception('Malformed UTF-8 characters, possibly incorrectly encoded');
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('Generic or unknown JSON error while decoding');
|
||||
break;
|
||||
}
|
||||
|
||||
return $payload;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('is_serialized')) {
|
||||
/**
|
||||
* Check a value to find if it was serialized.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user