fix minor bugs caused by batch-import plugin

This commit is contained in:
printempw 2017-01-01 16:37:29 +08:00
parent 177c25bfb4
commit fb64056cbd
2 changed files with 6 additions and 4 deletions

View File

@ -3,7 +3,7 @@
namespace App\Services;
use Log;
use Storage;
use Storage as LaravelStorage;
use App\Exceptions\PrettyPageException;
class Utils
@ -47,8 +47,8 @@ class Utils
if (file_exists($absolute_path)) {
$hash = hash_file('sha256', $absolute_path);
if (!Storage::disk('textures')->has($hash)) {
Storage::disk('textures')->move($path, $hash);
if (!LaravelStorage::disk('textures')->has($hash)) {
LaravelStorage::disk('textures')->move($path, $hash);
} else {
// delete the temp file
unlink($absolute_path);

View File

@ -236,8 +236,10 @@ if (! function_exists('bs_announcement')) {
if (! function_exists('bs_nickname')) {
function bs_nickname(\App\Models\User $user)
function bs_nickname(\App\Models\User $user = null)
{
$user = $user ?: app('users')->getCurrentUser();
return ($user->getNickName() == '') ? $user->email : $user->getNickName();
}
}