|
@ -11,7 +11,6 @@ use Illuminate\Http\Request; |
|
|
use App\Http\Controllers\Controller; |
|
|
use App\Http\Controllers\Controller; |
|
|
use App\Http\Resources\FileResource; |
|
|
use App\Http\Resources\FileResource; |
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
use Illuminate\Http\Exceptions\HttpResponseException; |
|
|
|
|
|
|
|
|
|
|
|
class TaskFileController extends Controller |
|
|
class TaskFileController extends Controller |
|
|
{ |
|
|
{ |
|
@ -41,7 +40,7 @@ class TaskFileController extends Controller |
|
|
// guest or de active
|
|
|
// guest or de active
|
|
|
// return files as file resource
|
|
|
// return files as file resource
|
|
|
[$business, $project, $task] = $this->checkBelonging($business, $project, $task); |
|
|
[$business, $project, $task] = $this->checkBelonging($business, $project, $task); |
|
|
return FileResource::collection($task->files); |
|
|
|
|
|
|
|
|
return FileResource::collection($task->files ?? []); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function sync(Request $request,int $business, int $project, int $task) |
|
|
public function sync(Request $request,int $business, int $project, int $task) |
|
@ -78,7 +77,7 @@ class TaskFileController extends Controller |
|
|
// return the file resource or stream it
|
|
|
// return the file resource or stream it
|
|
|
[$business, $project, $task] = $this->checkBelonging($business, $project, $task); |
|
|
[$business, $project, $task] = $this->checkBelonging($business, $project, $task); |
|
|
|
|
|
|
|
|
$file = File::find($file); |
|
|
|
|
|
|
|
|
$file = File::findOrFail($file); |
|
|
if ($file->user_id !== Auth::id()) { |
|
|
if ($file->user_id !== Auth::id()) { |
|
|
abort(Response::HTTP_UNAUTHORIZED); |
|
|
abort(Response::HTTP_UNAUTHORIZED); |
|
|
} |
|
|
} |
|
|