File tree Expand file tree Collapse file tree 4 files changed +8
-19
lines changed Expand file tree Collapse file tree 4 files changed +8
-19
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use App \Models \ChatThread ;
6
6
use Illuminate \Http \Request ;
7
- use Illuminate \Support \Str ;
7
+ use Illuminate \Support \Facades \ Auth ;
8
8
9
9
class ThreadController extends Controller
10
10
{
11
11
public function share (ChatThread $ thread )
12
12
{
13
- $ this ->authorize ('view ' , $ thread );
13
+ if ($ thread ->user_id !== Auth::id ()) {
14
+ abort (403 );
15
+ }
14
16
if (!$ thread ->is_public ) {
15
17
$ thread ->update (['is_public ' => true ]);
16
18
}
Original file line number Diff line number Diff line change @@ -12,32 +12,19 @@ class User extends Authenticatable
12
12
/** @use HasFactory<\Database\Factories\UserFactory> */
13
13
use HasFactory, Notifiable;
14
14
15
- /**
16
- * The attributes that are mass assignable.
17
- *
18
- * @var list<string>
19
- */
20
15
protected $ fillable = [
21
16
'name ' ,
22
17
'email ' ,
23
18
'password ' ,
19
+ 'role ' ,
20
+ 'credits ' ,
24
21
];
25
22
26
- /**
27
- * The attributes that should be hidden for serialization.
28
- *
29
- * @var list<string>
30
- */
31
23
protected $ hidden = [
32
24
'password ' ,
33
25
'remember_token ' ,
34
26
];
35
27
36
- /**
37
- * Get the attributes that should be cast.
38
- *
39
- * @return array<string, string>
40
- */
41
28
protected function casts (): array
42
29
{
43
30
return [
Original file line number Diff line number Diff line change 18
18
$ middleware ->alias ([
19
19
'admin ' => AdminOnly::class,
20
20
]);
21
+ $ middleware ->statefulApi ();
22
+ $ middleware ->throttleApi ();
21
23
})
22
24
->withExceptions (function (Exceptions $ exceptions ): void {
23
25
//
Original file line number Diff line number Diff line change 5
5
use App \Http \Controllers \InstallerController ;
6
6
use App \Http \Controllers \PaymentController ;
7
7
use App \Http \Controllers \CreditPackageController ;
8
- use App \Http \Controllers \BlogPostController ;
9
8
use App \Http \Controllers \PageController ;
10
9
use App \Http \Controllers \ThreadController ;
11
10
use App \Http \Controllers \Admin \PaymentAdminController ;
26
25
Route::view ('/ ' , 'admin.index ' )->name ('index ' );
27
26
Route::resource ('agents ' , AgentController::class);
28
27
Route::resource ('packages ' , CreditPackageController::class)->except (['show ' ]);
29
- Route::resource ('blog ' , BlogPostController::class);
30
28
Route::resource ('pages ' , PageController::class);
31
29
Route::get ('payments ' , [PaymentAdminController::class, 'index ' ])->name ('payments.index ' );
32
30
Route::post ('payments/{payment}/approve ' , [PaymentAdminController::class, 'approve ' ])->name ('payments.approve ' );
You can’t perform that action at this time.
0 commit comments