mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 06:44:37 -04:00
Working on dropzone uploads
This commit is contained in:
parent
3e91a4f700
commit
fac762391a
@ -52,15 +52,19 @@ class DocumentController extends Controller
|
|||||||
|
|
||||||
Log::error($request->all());
|
Log::error($request->all());
|
||||||
|
|
||||||
Storage::makeDirectory(public_path() . $contact->client->client_hash, 0755);
|
Storage::makeDirectory('public/' . $contact->client->client_hash, 0755);
|
||||||
|
|
||||||
$path = Storage::putFile($contact->client->client_hash, $request->file('file'));
|
$path = Storage::putFile('public/' . $contact->client->client_hash, $request->file('file'));
|
||||||
|
|
||||||
$url = Storage::url($path);
|
$url = Storage::url($path);
|
||||||
|
|
||||||
Log::error($path);
|
Log::error($path);
|
||||||
Log::error($url);
|
Log::error($url);
|
||||||
|
|
||||||
|
tap((auth()->user())->update([
|
||||||
|
'avatar' => $url,
|
||||||
|
]));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
[2019-08-07 05:50:23] local.ERROR: array (
|
[2019-08-07 05:50:23] local.ERROR: array (
|
||||||
'_token' => '7KoEVRjB2Fq8XBVFRUFbhQFjKm4rY9h0AGSlpdj3',
|
'_token' => '7KoEVRjB2Fq8XBVFRUFbhQFjKm4rY9h0AGSlpdj3',
|
||||||
|
@ -37,6 +37,7 @@ class ProfileController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit(ClientContact $client_contact)
|
public function edit(ClientContact $client_contact)
|
||||||
{
|
{
|
||||||
|
/* Dropzone configuration */
|
||||||
$data = [
|
$data = [
|
||||||
'params' => [
|
'params' => [
|
||||||
'is_avatar' => TRUE,
|
'is_avatar' => TRUE,
|
||||||
|
@ -36,13 +36,12 @@ class BaseModel extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $dateFormat = 'Y-m-d H:i:s.u';
|
protected $dateFormat = 'Y-m-d H:i:s.u';
|
||||||
|
|
||||||
public function getHashedIdAttribute()
|
public function getHashedIdAttribute()
|
||||||
{
|
{
|
||||||
return $this->encodePrimaryKey($this->id);
|
return $this->encodePrimaryKey($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function __call($method, $params)
|
public function __call($method, $params)
|
||||||
{
|
{
|
||||||
$entity = strtolower(class_basename($this));
|
$entity = strtolower(class_basename($this));
|
||||||
|
@ -68,7 +68,7 @@ class ClientContact extends Authenticatable
|
|||||||
'email',
|
'email',
|
||||||
'avatar',
|
'avatar',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
public function getRouteKeyName()
|
public function getRouteKeyName()
|
||||||
{
|
{
|
||||||
@ -80,6 +80,14 @@ class ClientContact extends Authenticatable
|
|||||||
return $this->encodePrimaryKey($this->id);
|
return $this->encodePrimaryKey($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAvatarAttribute()
|
||||||
|
{
|
||||||
|
if(!filter_var($this->attributes['avatar'], FILTER_VALIDATE_URL))
|
||||||
|
return url('/') . $this->attributes['avatar'];
|
||||||
|
else
|
||||||
|
return $this->attributes['avatar'];
|
||||||
|
}
|
||||||
|
|
||||||
public function client()
|
public function client()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Client::class);
|
return $this->belongsTo(Client::class);
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
.dropzone .dz-preview .dz-image {
|
||||||
|
width: 250px;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@stop
|
@stop
|
||||||
<div id="dropzone">
|
<div id="dropzone">
|
||||||
@ -37,6 +41,8 @@
|
|||||||
'{!! $key !!}' : '{!! $value !!}',
|
'{!! $key !!}' : '{!! $value !!}',
|
||||||
@endforeach
|
@endforeach
|
||||||
},
|
},
|
||||||
|
thumbnailWidth: 250,
|
||||||
|
thumbnailHeight: 250,
|
||||||
addRemoveLinks: true,
|
addRemoveLinks: true,
|
||||||
dictRemoveFileConfirmation: "{{ctrans('texts.are_you_sure')}}",
|
dictRemoveFileConfirmation: "{{ctrans('texts.are_you_sure')}}",
|
||||||
dictDefaultMessage : "{{ctrans('texts.dropzone_default_message')}}",
|
dictDefaultMessage : "{{ctrans('texts.dropzone_default_message')}}",
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<i class="fa fa-user fa-5x"></i>
|
|
||||||
|
|
||||||
@include('generic.dropzone')
|
@include('generic.dropzone')
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user