thekordy / ticketit

A simple helpdesk tickets system for Laravel 5.1+ which integrates smoothly with Laravel default users and auth system, demo is available at: http://ticketit.kordy.info/tickets
MIT License
875 stars 387 forks source link

Make sure that App\User exists #579

Open fasi1208 opened 3 years ago

fasi1208 commented 3 years ago

Under installation steps. In point 3

Step 3. Check if App\User exists

If I navigate to this link it shows

`<?php

namespace App;

class User extends Models\User { //leave this empty }`

I have few questions

  1. What to write inside the class?
  2. If it is supposed to be empty then what is the point of creating it?
  3. How to create a user?
matiaslauriti commented 3 years ago

I am new here and I was helping a user with the same problem on SO.

The idea is that this package still uses the old Laravel model's pattern (have models in app instead of app\models) but this changed on Laravel 8 by default. So for this package to work (because it is doing use App\User; where it needs it) you have to have that class autoloaded/available, hence if you have your model on App\Models\User, you can "alias" it by creating a class that extends the original but is also available as App\User.

That is why it is empty, it is just an alias... This is one file that uses this:

https://github.com/thekordy/ticketit/blob/110d5d78fb997d0ba5d2ac6b9a4f9e31896976bd/src/Models/Agent.php#L5


So:

  1. Write nothing, copy paste what is in the example.
  2. This is just an alias for autoloading.
  3. You still use App\Models\User for anything else.