Skip to content

Commit

Permalink
change model name
Browse files Browse the repository at this point in the history
  • Loading branch information
klgd committed Apr 28, 2017
1 parent b6a028f commit d1f27a9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
17 changes: 14 additions & 3 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Auth;
use Sco\ActionLog\Events\AbstractEvent;
use Sco\ActionLog\Models\ActionLog;
use Sco\ActionLog\Models\ActionLogModel;

class Factory
{
Expand All @@ -22,7 +22,7 @@ public function event(AbstractEvent $event)
return false;
}

$log = new ActionLog();
$log = new ActionLogModel();

$log->user_id = $userId;
$log->type = $event->getAttribute('type', '');
Expand All @@ -46,7 +46,7 @@ public function event(AbstractEvent $event)
*/
public function info($type, $content, $tableName = '')
{
$log = new ActionLog();
$log = new ActionLogModel();

$userId = Auth::id();
if (!$userId && !config('actionlog.guest')) {
Expand All @@ -63,4 +63,15 @@ public function info($type, $content, $tableName = '')

return true;
}

public function __call($method, $parameters)
{
return (new ActionLogModel)->$method(...$parameters);
}


public static function __callStatic($method, $parameters)
{
return (new static)->$method(...$parameters);
}
}
18 changes: 9 additions & 9 deletions src/Models/ActionLog.php → src/Models/ActionLogModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
* @property string $client_ip 操作者IP
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereClientIp($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereContent($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereTableName($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereType($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLog whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereClientIp($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereContent($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereTableName($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereType($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Sco\ActionLog\Models\ActionLogModel whereUserId($value)
* @mixin \Eloquent
*/
class ActionLog extends Model
class ActionLogModel extends Model
{
public function __construct(array $attributes = [])
{
Expand Down

0 comments on commit d1f27a9

Please sign in to comment.