Issues (1925)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

app/Http/Controllers/ResourceController.php (15 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Http\Controllers;
9
10
use App\Models\Resource;
11
use Carbon\Carbon;
12
use App\Events\Obyx;
13
use Illuminate\Http\Request;
14
use App\Helpers\DatabaseHelper;
15
16
class ResourceController extends Controller
17
{
18
    public function index()
19
    {
20
        $res = \DB::table('resources')
21
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
22
            ->leftJoin('comments', function ($join) {
23
                $join->on('comments.content_id', '=', 'resources.id');
24
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
25
            })
26
            ->select([
27
                'resources.id as resid',
28
                'resources.type as restype',
29
                'resources.cat as rescat',
30
                'resources.user_id as userid',
31
                'users.name as username',
32
                'resources.title as restitle',
33
                'resources.created_at as rescreatedat',
34
                'resources.content_type as contenttype',
35
            ])
36
            ->selectRaw('COUNT(comments.id) AS commentcount')
37
            ->selectRaw('SUM(comments.vote_up) AS voteup')
38
            ->selectRaw('SUM(comments.vote_down) AS votedown')
39
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
40
            ->groupBy('resources.id')
41
            ->orderBy('resources.created_at', 'desc')
42
            ->limit(20)
43
            ->get();
44
45
        return view('resources.index', [
46
            'resources'   => $res,
47
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
48
        ]);
49
    }
50
51 View Code Duplication
    public function index_gfx()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
52
    {
53
        $res = \DB::table('resources')
54
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
55
            ->leftJoin('comments', function ($join) {
56
                $join->on('comments.content_id', '=', 'resources.id');
57
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
58
            })
59
            ->select([
60
                'resources.id as resid',
61
                'resources.type as restype',
62
                'resources.cat as rescat',
63
                'resources.user_id as userid',
64
                'users.name as username',
65
                'resources.title as restitle',
66
                'resources.created_at as rescreatedat',
67
                'resources.content_type as contenttype',
68
            ])
69
            ->selectRaw('COUNT(comments.id) AS commentcount')
70
            ->selectRaw('SUM(comments.vote_up) AS voteup')
71
            ->selectRaw('SUM(comments.vote_down) AS votedown')
72
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
73
            ->where('resources.type', '=', 'gfx')
74
            ->groupBy('resources.id')
75
            ->orderBy('resources.created_at', 'desc')
76
            ->limit(20)
77
            ->get();
78
79
        return view('resources.gfx.index', [
80
            'resources'   => $res,
81
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
82
        ]);
83
    }
84
85 View Code Duplication
    public function index_sfx()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
86
    {
87
        $res = \DB::table('resources')
88
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
89
            ->leftJoin('comments', function ($join) {
90
                $join->on('comments.content_id', '=', 'resources.id');
91
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
92
            })
93
            ->select([
94
                'resources.id as resid',
95
                'resources.type as restype',
96
                'resources.cat as rescat',
97
                'resources.user_id as userid',
98
                'users.name as username',
99
                'resources.title as restitle',
100
                'resources.created_at as rescreatedat',
101
                'resources.content_type as contenttype',
102
            ])
103
            ->selectRaw('COUNT(comments.id) AS commentcount')
104
            ->selectRaw('SUM(comments.vote_up) AS voteup')
105
            ->selectRaw('SUM(comments.vote_down) AS votedown')
106
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
107
            ->where('resources.type', '=', 'sfx')
108
            ->groupBy('resources.id')
109
            ->orderBy('resources.created_at', 'desc')
110
            ->limit(20)
111
            ->get();
112
113
        return view('resources.sfx.index', [
114
            'resources'   => $res,
115
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
116
        ]);
117
    }
118
119 View Code Duplication
    public function index_scripts()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
120
    {
121
        $res = \DB::table('resources')
122
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
123
            ->leftJoin('comments', function ($join) {
124
                $join->on('comments.content_id', '=', 'resources.id');
125
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
126
            })
127
            ->select([
128
                'resources.id as resid',
129
                'resources.type as restype',
130
                'resources.cat as rescat',
131
                'resources.user_id as userid',
132
                'users.name as username',
133
                'resources.title as restitle',
134
                'resources.created_at as rescreatedat',
135
                'resources.content_type as contenttype',
136
            ])
137
            ->selectRaw('COUNT(comments.id) AS commentcount')
138
            ->selectRaw('SUM(comments.vote_up) AS voteup')
139
            ->selectRaw('SUM(comments.vote_down) AS votedown')
140
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
141
            ->where('resources.type', '=', 'scripts')
142
            ->groupBy('resources.id')
143
            ->orderBy('resources.created_at', 'desc')
144
            ->limit(20)
145
            ->get();
146
147
        return view('resources.scripts.index', [
148
            'resources'   => $res,
149
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
150
        ]);
151
    }
152
153 View Code Duplication
    public function index_tools()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
154
    {
155
        $res = \DB::table('resources')
156
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
157
            ->leftJoin('comments', function ($join) {
158
                $join->on('comments.content_id', '=', 'resources.id');
159
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
160
            })
161
            ->select([
162
                'resources.id as resid',
163
                'resources.type as restype',
164
                'resources.cat as rescat',
165
                'resources.user_id as userid',
166
                'users.name as username',
167
                'resources.title as restitle',
168
                'resources.created_at as rescreatedat',
169
                'resources.content_type as contenttype',
170
            ])
171
            ->selectRaw('COUNT(comments.id) AS commentcount')
172
            ->selectRaw('SUM(comments.vote_up) AS voteup')
173
            ->selectRaw('SUM(comments.vote_down) AS votedown')
174
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
175
            ->where('resources.type', '=', 'tools')
176
            ->groupBy('resources.id')
177
            ->orderBy('resources.created_at', 'desc')
178
            ->limit(20)
179
            ->get();
180
181
        return view('resources.tools.index', [
182
            'resources'   => $res,
183
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
184
        ]);
185
    }
186
187 View Code Duplication
    public function index_gfx_cat($cat)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
188
    {
189
        $res = \DB::table('resources')
190
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
191
            ->leftJoin('comments', function ($join) {
192
                $join->on('comments.content_id', '=', 'resources.id');
193
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
194
            })
195
            ->select([
196
                'resources.id as resid',
197
                'resources.type as restype',
198
                'resources.cat as rescat',
199
                'resources.user_id as userid',
200
                'users.name as username',
201
                'resources.title as restitle',
202
                'resources.created_at as rescreatedat',
203
                'resources.content_type as contenttype',
204
            ])
205
            ->selectRaw('COUNT(comments.id) AS commentcount')
206
            ->selectRaw('SUM(comments.vote_up) AS voteup')
207
            ->selectRaw('SUM(comments.vote_down) AS votedown')
208
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
209
            ->where('resources.type', '=', 'gfx')
210
            ->where('resources.cat', '=', $cat)
211
            ->groupBy('resources.id')
212
            ->orderBy('resources.created_at', 'desc')
213
            ->get();
214
215
        return view('resources.gfx.index_cat', [
216
            'resources'   => $res,
217
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
218
        ]);
219
    }
220
221 View Code Duplication
    public function index_sfx_cat($cat)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
222
    {
223
        $res = \DB::table('resources')
224
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
225
            ->leftJoin('comments', function ($join) {
226
                $join->on('comments.content_id', '=', 'resources.id');
227
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
228
            })
229
            ->select([
230
                'resources.id as resid',
231
                'resources.type as restype',
232
                'resources.cat as rescat',
233
                'resources.user_id as userid',
234
                'users.name as username',
235
                'resources.title as restitle',
236
                'resources.created_at as rescreatedat',
237
                'resources.content_type as contenttype',
238
            ])
239
            ->selectRaw('COUNT(comments.id) AS commentcount')
240
            ->selectRaw('SUM(comments.vote_up) AS voteup')
241
            ->selectRaw('SUM(comments.vote_down) AS votedown')
242
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
243
            ->where('resources.type', '=', 'sfx')
244
            ->where('resources.cat', '=', $cat)
245
            ->groupBy('resources.id')
246
            ->orderBy('resources.created_at', 'desc')
247
            ->get();
248
249
        return view('resources.sfx.index_cat', [
250
            'resources'   => $res,
251
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
252
        ]);
253
    }
254
255 View Code Duplication
    public function index_scripts_cat($cat)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
256
    {
257
        $res = \DB::table('resources')
258
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
259
            ->leftJoin('comments', function ($join) {
260
                $join->on('comments.content_id', '=', 'resources.id');
261
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
262
            })
263
            ->select([
264
                'resources.id as resid',
265
                'resources.type as restype',
266
                'resources.cat as rescat',
267
                'resources.user_id as userid',
268
                'users.name as username',
269
                'resources.title as restitle',
270
                'resources.created_at as rescreatedat',
271
                'resources.content_type as contenttype',
272
            ])
273
            ->selectRaw('COUNT(comments.id) AS commentcount')
274
            ->selectRaw('SUM(comments.vote_up) AS voteup')
275
            ->selectRaw('SUM(comments.vote_down) AS votedown')
276
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
277
            ->where('resources.type', '=', 'scripts')
278
            ->where('resources.cat', '=', $cat)
279
            ->groupBy('resources.id')
280
            ->orderBy('resources.created_at', 'desc')
281
            ->get();
282
283
        return view('resources.scripts.index_cat', [
284
            'resources'   => $res,
285
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
286
        ]);
287
    }
288
289 View Code Duplication
    public function index_tools_cat($cat)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
290
    {
291
        $res = \DB::table('resources')
292
            ->leftJoin('users', 'users.id', '=', 'resources.user_id')
293
            ->leftJoin('comments', function ($join) {
294
                $join->on('comments.content_id', '=', 'resources.id');
295
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
296
            })
297
            ->select([
298
                'resources.id as resid',
299
                'resources.type as restype',
300
                'resources.cat as rescat',
301
                'resources.user_id as userid',
302
                'users.name as username',
303
                'resources.title as restitle',
304
                'resources.created_at as rescreatedat',
305
                'resources.content_type as contenttype',
306
            ])
307
            ->selectRaw('COUNT(comments.id) AS commentcount')
308
            ->selectRaw('SUM(comments.vote_up) AS voteup')
309
            ->selectRaw('SUM(comments.vote_down) AS votedown')
310
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
311
            ->where('resources.type', '=', 'tools')
312
            ->where('resources.cat', '=', $cat)
313
            ->groupBy('resources.id')
314
            ->orderBy('resources.created_at', 'desc')
315
            ->get();
316
317
        return view('resources.tools.index_cat', [
318
            'resources'   => $res,
319
            'commentsmax' => DatabaseHelper::getCommentsMax('resource'),
320
        ]);
321
    }
322
323
    public function show($type, $cat, $id)
324
    {
325
        $resource = \DB::table('resources')
326
            ->leftJoin('users', 'resources.user_id', '=', 'users.id')
327
            ->leftJoin('comments', function ($join) {
328
                $join->on('comments.content_id', '=', 'resources.id');
329
                $join->on('comments.content_type', '=', \DB::raw("'resource'"));
330
            })
331
            ->select([
332
                'resources.id as id',
333
                'resources.type as type',
334
                'resources.cat as cat',
335
                'resources.title as title',
336
                'resources.desc_html as desc_html',
337
                'resources.created_at as created_at',
338
                'resources.content_type as content_type',
339
                'resources.content_path as content_path',
340
                'users.name as username',
341
                'users.id as userid',
342
            ])
343
            ->selectRaw('COUNT(comments.id) AS commentcount')
344
            ->selectRaw('SUM(comments.vote_up) AS voteup')
345
            ->selectRaw('SUM(comments.vote_down) AS votedown')
346
            ->selectRaw('(SUM(comments.vote_up) - SUM(comments.vote_down) / (SUM(comments.vote_up) + SUM(comments.vote_down))) AS voteavg ')
347
            ->where('resources.id', '=', $id)
348
            ->where('resources.cat', '=', $cat)
349
            ->where('resources.type', '=', $type)
350
            ->first();
351
352
        $comments = \DB::table('comments')
353
            ->leftJoin('users', 'comments.user_id', '=', 'users.id')
354
            ->select(['comments.id', 'comments.user_id', 'comments.comment_html', 'comments.created_at', 'users.name',
355
                'comments.vote_up', 'comments.vote_down', ])
356
            ->where('content_type', '=', \DB::raw("'resource'"))
357
            ->where('content_id', '=', $id)
358
            ->orderBy('created_at', 'asc')->get();
359
360
        return view('resources.show', [
361
            'resource' => $resource,
362
            'comments' => $comments,
363
        ]);
364
    }
365
366
    public function create()
367
    {
368
        return view('resources.create');
369
    }
370
371
    public function create_steps(Request $request)
372
    {
373
        return view('resources.create', [
374
            'request' => $request,
375
        ]);
376
    }
377
378
    public function store(Request $request)
379
    {
380
        $this->validate($request, [
381
            'step'         => 'required',
382
            'type'         => 'required|not_in:0',
383
            'cat'          => 'required|not_in:0',
384
            'title'        => 'required',
385
            'desc'         => 'required',
386
            'content_type' => 'required',
387
        ]);
388
389
        if ($request->get('content_type') == 'url') {
390
            if (filter_var($request->get('url'), FILTER_VALIDATE_URL)) {
391
                $content_path = $request->get('url');
392
            } else {
393
                return back()->withInput();
394
            }
395
        } else {
396
            $storagetemp = 'temp/'.$request->get('uuid').'/file';
397
            $storagedest = 'resources/'.$request->get('uuid').'.'.$request->get('ext');
398
399
            $exists = \Storage::disk('local')->exists($storagetemp);
400
            if ($exists === true) {
401
                \Storage::move($storagetemp, $storagedest);
402
            } else {
403
                return back()->withInput();
404
            }
405
406
            $content_path = $storagedest;
407
        }
408
409
        $res = new Resource();
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 15 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
410
        $res->type = $request->get('type');
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
411
        $res->cat = $request->get('cat');
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
412
        $res->user_id = \Auth::id();
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
413
        $res->title = $request->get('title');
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
414
        $res->desc_md = $request->get('msg');
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
415
        $res->desc_html = \Markdown::convertToHtml($request->get('msg'));
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
416
        $res->content_path = $content_path;
417
        $res->content_type = $request->get('content_type');
418
        $res->save();
419
420
        event(new Obyx('resource-add', \Auth::id()));
421
422
        return redirect()->route('resources');
423
    }
424
}
425