Upload a file

This commit is contained in:
David Bomba 2019-04-28 20:25:18 +10:00
parent 897794dd66
commit a54fd4b931
5 changed files with 85 additions and 3 deletions

View File

@ -69,7 +69,11 @@ class UserController extends BaseController
*/
public function store(StoreUserRequest $request)
{
//
//save user
//attach user to company
}
/**

View File

@ -18,6 +18,15 @@ class StoreUserRequest extends Request
return auth()->user()->can('create', User::class);
}
public function rules()
{
return [
'first_name' => 'required|string|max:100',
'last_name' => 'required|string:max:100',
'email' => new UniqueUserRule(),
];
}
public function sanitize()
{

View File

@ -20,4 +20,13 @@ class UpdateUserRequest extends Request
}
public function rules()
{
return [
'first_name' => 'required|string|max:100',
'last_name' => 'required|string:max:100',
'email' => new UniqueUserRule(),
];
}
}

View File

@ -6,6 +6,65 @@ use Illuminate\Database\Eloquent\Model;
class Document extends BaseModel
{
/**
* @var array
*/
protected $fillable = [
'is_default',
];
/**
* @var array
*/
public static $types = [
'png' => [
'mime' => 'image/png',
],
'ai' => [
'mime' => 'application/postscript',
],
'svg' => [
'mime' => 'image/svg+xml',
],
'jpeg' => [
'mime' => 'image/jpeg',
],
'tiff' => [
'mime' => 'image/tiff',
],
'pdf' => [
'mime' => 'application/pdf',
],
'gif' => [
'mime' => 'image/gif',
],
'psd' => [
'mime' => 'image/vnd.adobe.photoshop',
],
'txt' => [
'mime' => 'text/plain',
],
'doc' => [
'mime' => 'application/msword',
],
'xls' => [
'mime' => 'application/vnd.ms-excel',
],
'ppt' => [
'mime' => 'application/vnd.ms-powerpoint',
],
'xlsx' => [
'mime' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
],
'docx' => [
'mime' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
],
'pptx' => [
'mime' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
];
public function documentable()
{
return $this->morphTo();

View File

@ -26,13 +26,14 @@ class Invoice extends BaseModel
];
const STATUS_DRAFT = 1;
const STATUS_SENT = 2;
const STATUS_SENT = 2;
const STATUS_PARTIAL = 5;
const STATUS_PAID = 6;
const STATUS_REVERSED = 7; //new for V2
const STATUS_CANCELLED = 8;
const STATUS_OVERDUE = -1;
const STATUS_UNPAID = -2;
const STATUS_REVERSED = -7; //new for V2
public function company()
{