Created
June 20, 2017 10:00
-
-
Save cpereiraweb/55940526daa6e33706cd86efa4afc835 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Created by PhpStorm. | |
* User: claudio | |
* Date: 01/11/16 | |
* Time: 22:40 | |
*/ | |
namespace SnPortal\Observers; | |
use SnPortal\Models\Client; | |
class ClientObserver | |
{ | |
/** | |
* Listen to the Client creating event. | |
* | |
* @param Client $client | |
* @return void | |
*/ | |
public function creating(Client $client) | |
{ | |
$client->created_by = (App::runningInConsole()?1:\Auth::user()->id); // Se estiver rodando via artisan, atribui 1 | |
$client->updated_by = (App::runningInConsole()?1:\Auth::user()->id); // Se estiver rodando via artisan, atribui 1 | |
} | |
/** | |
* Listen to the Client updating event. | |
* | |
* @param Client $client | |
* @return void | |
*/ | |
public function updating(Client $client) | |
{ | |
dd(\Auth::user()); | |
$client->updated_by = (App::runningInConsole()?1:\Auth::user()->id); // Se estiver rodando via artisan, atribui 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment