A lot of things.
This commit is contained in:
34
app/Jobs/CreateXenForoCommentsThread.php
Normal file
34
app/Jobs/CreateXenForoCommentsThread.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\Entry;
|
||||||
|
use App\Services\XenforoApiService;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Queue\Queueable;
|
||||||
|
|
||||||
|
class CreateXenForoCommentsThread implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
public $tries = 3;
|
||||||
|
public $backoff = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
protected Entry $entry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*/
|
||||||
|
public function handle(XenforoApiService $service): void
|
||||||
|
{
|
||||||
|
$service->createCommentsThread($this->entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
39
app/Policies/EntryPolicy.php
Normal file
39
app/Policies/EntryPolicy.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use App\Models\Entry;
|
||||||
|
use App\Auth\XenForoUser as User;
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
|
||||||
|
class EntryPolicy
|
||||||
|
{
|
||||||
|
|
||||||
|
public function view(User $user): bool
|
||||||
|
{
|
||||||
|
if( $user->_can( 'romhackplaza', 'view' ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(User $user, ?Entry $entry = null ): bool
|
||||||
|
{
|
||||||
|
return $user->_can( 'romhackplaza', 'canSubmitEntry' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, Entry $entry): bool
|
||||||
|
{
|
||||||
|
if( $user->_can('romhackplaza', 'canEditOthersEntries') )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if( $user->_can( 'romhackplaza', 'canEditMyEntries' ) && $entry->user_id === $user->user_id )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
13
app/Policies/TempFilePolicy.php
Normal file
13
app/Policies/TempFilePolicy.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use App\Auth\XenForoUser as User;
|
||||||
|
|
||||||
|
class TempFilePolicy
|
||||||
|
{
|
||||||
|
public function create(User $user)
|
||||||
|
{
|
||||||
|
return $user->_can( 'romhackplaza', 'canSubmitTempFile' );
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user