PHP code example of rene-roscher / laravel-tickets

1. Go to this page and download the library: Download rene-roscher/laravel-tickets library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rene-roscher / laravel-tickets example snippets



use RexlManu\LaravelTickets\Traits\HasTickets;

class User
{
    use HasTickets; // important for laravel-tickets
}


use Illuminate\Routing\Controller;
use RexlManu\LaravelTickets\Controllers\TicketControllable;

class TicketController extends Controller {

  use TicketControllable;

}

Route::tickets( TicketController::class );


use Illuminate\Database\Eloquent\Model;
use RexlManu\LaravelTickets\Interfaces\TicketReference;
use RexlManu\LaravelTickets\Traits\HasTicketReference;

class ExampleModel extends Model implements TicketReference {

  use HasTicketReference;

  // Check if user has access to this model
  function hasReferenceAccess() : bool {
      return request()->user()->user_id == $this->user_id;
  }

}

bash
php artisan vendor:publish --provider=RexlManu\LaravelTickets\LaravelTicketsServiceProvider