update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
|
|
@ -15,33 +15,34 @@ class FileController extends Controller
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct() {}
|
||||
|
||||
private function isPermissionShoppingOrder($shopping_order)
|
||||
{
|
||||
}
|
||||
|
||||
private function isPermissionShoppingOrder($shopping_order){
|
||||
$user_id = $shopping_order->auth_user_id ? $shopping_order->auth_user_id : $shopping_order->member_id;
|
||||
if(Auth::user()->isAdmin() || $user_id == Auth::user()->id){
|
||||
if (Auth::user()->isAdmin() || $user_id == Auth::user()->id) {
|
||||
return true;
|
||||
}
|
||||
abort(404);
|
||||
abort(404);
|
||||
}
|
||||
|
||||
private function isPermissionUserCredit($user_credit){
|
||||
if(Auth::user()->isAdmin() || $user_credit->user_id == Auth::user()->id){
|
||||
private function isPermissionUserCredit($user_credit)
|
||||
{
|
||||
if (Auth::user()->isAdmin() || $user_credit->user_id == Auth::user()->id) {
|
||||
return true;
|
||||
}
|
||||
abort(404);
|
||||
abort(404);
|
||||
}
|
||||
|
||||
private function isPermissionAuth(){
|
||||
if(Auth::check()){
|
||||
private function isPermissionAuth()
|
||||
{
|
||||
if (Auth::check()) {
|
||||
return true;
|
||||
}
|
||||
abort(404);
|
||||
abort(403, "Nicht autorisiert");
|
||||
}
|
||||
|
||||
public function show($id = null, $from = null, $do='file')
|
||||
public function show($id = null, $from = null, $do = 'file')
|
||||
{
|
||||
|
||||
$path = "";
|
||||
|
|
@ -56,69 +57,68 @@ class FileController extends Controller
|
|||
return Response::file($path);
|
||||
}
|
||||
}*/
|
||||
if ($from === 'invoice'){
|
||||
if ($from === 'invoice') {
|
||||
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->user_invoice){
|
||||
if ($shopping_order->user_invoice) {
|
||||
$this->isPermissionShoppingOrder($shopping_order);
|
||||
$user_invoice = $shopping_order->user_invoice;
|
||||
$filename = $user_invoice->filename;
|
||||
$disk = $user_invoice->disk;
|
||||
$path = $user_invoice->getDownloadPath();
|
||||
$filename = $user_invoice->filename;
|
||||
$disk = $user_invoice->disk;
|
||||
$path = $user_invoice->getDownloadPath();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($from === 'delivery'){
|
||||
if ($from === 'delivery') {
|
||||
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->user_invoice){
|
||||
if ($shopping_order->user_invoice) {
|
||||
$this->isPermissionShoppingOrder($shopping_order);
|
||||
$user_invoice = $shopping_order->user_invoice;
|
||||
$filename = $user_invoice->delivery_filename;
|
||||
$disk = $user_invoice->disk;
|
||||
$filename = $user_invoice->delivery_filename;
|
||||
$disk = $user_invoice->disk;
|
||||
$path = $user_invoice->getDownloadPathDelivery();
|
||||
}
|
||||
}
|
||||
|
||||
if ($from === 'credit'){
|
||||
if ($from === 'credit') {
|
||||
$user_credit = \App\Models\UserCredit::findOrFail($id);
|
||||
$this->isPermissionUserCredit($user_credit);
|
||||
$filename = $user_credit->filename;
|
||||
$disk = $user_credit->disk;
|
||||
$filename = $user_credit->filename;
|
||||
$disk = $user_credit->disk;
|
||||
$path = $user_credit->getDownloadPath();
|
||||
}
|
||||
|
||||
if ($from === 'credit_detail'){
|
||||
if ($from === 'credit_detail') {
|
||||
$user_credit = \App\Models\UserCredit::findOrFail($id);
|
||||
$this->isPermissionUserCredit($user_credit);
|
||||
|
||||
|
||||
return $this->create_credit_detail($user_credit, $do);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
$filename = $user_credit->filename;
|
||||
$disk = $user_credit->disk;
|
||||
$path = $user_credit->getDownloadPath();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
if ($from === 'dc_file'){
|
||||
$this->isPermissionAuth();
|
||||
|
||||
if ($from === 'dc_file') {
|
||||
// $this->isPermissionAuth();
|
||||
$dc_file = \App\Models\DcFile::findOrFail($id);
|
||||
$filename = $dc_file->filename;
|
||||
$disk = 'public';
|
||||
$path = $dc_file->getFile();
|
||||
}
|
||||
if ($from === 'dc_thumb'){
|
||||
$this->isPermissionAuth();
|
||||
if ($from === 'dc_thumb') {
|
||||
// $this->isPermissionAuth();
|
||||
$dc_file = \App\Models\DcFile::findOrFail($id);
|
||||
$filename = $dc_file->filename;
|
||||
$disk = 'public';
|
||||
$path = $dc_file->getThumb();
|
||||
}
|
||||
|
||||
if ($from === 'dc_big'){
|
||||
$this->isPermissionAuth();
|
||||
if ($from === 'dc_big') {
|
||||
// $this->isPermissionAuth();
|
||||
$dc_file = \App\Models\DcFile::findOrFail($id);
|
||||
$filename = $dc_file->filename;
|
||||
$disk = 'public';
|
||||
|
|
@ -127,7 +127,7 @@ class FileController extends Controller
|
|||
|
||||
|
||||
|
||||
if(!Storage::disk($disk)->exists($path)){
|
||||
if (!Storage::disk($disk)->exists($path)) {
|
||||
return Response::make('Datei nicht gefunden.', 404);
|
||||
}
|
||||
|
||||
|
|
@ -138,40 +138,41 @@ class FileController extends Controller
|
|||
$file = Storage::disk($disk)->get($path);
|
||||
$mime = Storage::disk($disk)->mimeType($path);
|
||||
|
||||
if(isset($file)){
|
||||
if($do === 'stream'){
|
||||
if (isset($file)) {
|
||||
if ($do === 'stream') {
|
||||
return Storage::disk($disk)->response($path, $filename);
|
||||
}
|
||||
|
||||
if($do === 'file'){
|
||||
if ($do === 'file') {
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $mime)
|
||||
->header("Content-Length", strlen($file))
|
||||
->header('Content-disposition', 'filename="'.$filename.'"');
|
||||
->header('Content-disposition', 'filename="' . $filename . '"');
|
||||
}
|
||||
if($do === 'image'){
|
||||
if ($do === 'image') {
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $mime);
|
||||
}
|
||||
if($do === 'pdf'){
|
||||
$path = storage_path().'/app/public/' . $path;
|
||||
if ($do === 'pdf') {
|
||||
$path = storage_path() . '/app/public/' . $path;
|
||||
|
||||
$headers = array(
|
||||
'Content-Type:'. $mime,
|
||||
// 'Content-Length: ' . $file->size
|
||||
// 'Content-Disposition: ' . $stream . '; filename=' . $file->original_name
|
||||
);
|
||||
|
||||
return Response::download($path, $filename, $headers);
|
||||
'Content-Type:' . $mime,
|
||||
// 'Content-Length: ' . $file->size
|
||||
// 'Content-Disposition: ' . $stream . '; filename=' . $file->original_name
|
||||
);
|
||||
|
||||
return Response::download($path, $filename, $headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function create_credit_detail(UserCredit $user_credit, $do){
|
||||
private function create_credit_detail(UserCredit $user_credit, $do)
|
||||
{
|
||||
|
||||
$credit_repo = new CreditRepository($user_credit->user);
|
||||
return $credit_repo->create_report($user_credit, $do);
|
||||
//\Session()->flash('alert-success', "Gutschrift erstellt");
|
||||
|
||||
$credit_repo = new CreditRepository($user_credit->user);
|
||||
return $credit_repo->create_report($user_credit, $do);
|
||||
//\Session()->flash('alert-success', "Gutschrift erstellt");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue