2019-08-07 02:44:38 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\ClientPortal;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Http\Requests\ClientPortal\StoreDocumentRequest;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
2019-08-07 08:56:19 +02:00
|
|
|
use Illuminate\Support\Facades\Storage;
|
2019-08-07 02:44:38 +02:00
|
|
|
|
|
|
|
class DocumentController extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display a listing of the resource.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the form for creating a new resource.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function create()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function store(StoreDocumentRequest $request)
|
|
|
|
{
|
2019-08-07 08:56:19 +02:00
|
|
|
$contact = auth()->user();
|
|
|
|
|
2019-08-07 02:44:38 +02:00
|
|
|
Log::error($request->all());
|
2019-08-07 08:56:19 +02:00
|
|
|
|
2019-08-08 02:22:54 +02:00
|
|
|
Storage::makeDirectory('public/' . $contact->client->client_hash, 0755);
|
2019-08-07 08:56:19 +02:00
|
|
|
|
2019-08-08 02:22:54 +02:00
|
|
|
$path = Storage::putFile('public/' . $contact->client->client_hash, $request->file('file'));
|
2019-08-07 08:56:19 +02:00
|
|
|
|
|
|
|
$url = Storage::url($path);
|
|
|
|
|
|
|
|
Log::error($path);
|
|
|
|
Log::error($url);
|
|
|
|
|
2019-08-08 10:13:32 +02:00
|
|
|
$contact = auth()->user();
|
|
|
|
|
|
|
|
tap($contact)->update([
|
2019-08-08 02:22:54 +02:00
|
|
|
'avatar' => $url,
|
2019-08-08 10:13:32 +02:00
|
|
|
]);
|
2019-08-08 02:22:54 +02:00
|
|
|
|
2019-08-07 08:56:19 +02:00
|
|
|
/*
|
|
|
|
[2019-08-07 05:50:23] local.ERROR: array (
|
|
|
|
'_token' => '7KoEVRjB2Fq8XBVFRUFbhQFjKm4rY9h0AGSlpdj3',
|
|
|
|
'is_avatar' => '1',
|
|
|
|
'q' => '/client/document',
|
|
|
|
'file' =>
|
|
|
|
Illuminate\Http\UploadedFile::__set_state(array(
|
|
|
|
'test' => false,
|
|
|
|
'originalName' => 'family.jpg',
|
|
|
|
'mimeType' => 'image/jpeg',
|
|
|
|
'error' => 0,
|
|
|
|
'hashName' => NULL,
|
|
|
|
)),
|
|
|
|
)
|
|
|
|
*/
|
2019-08-07 02:44:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the specified resource.
|
|
|
|
*
|
|
|
|
* @param int $id
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function show($id)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the form for editing the specified resource.
|
|
|
|
*
|
|
|
|
* @param int $id
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function edit($id)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the specified resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param int $id
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function update(Request $request, $id)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the specified resource from storage.
|
|
|
|
*
|
|
|
|
* @param int $id
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function destroy($id)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|