diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 11279ebe9280..f866699e561c 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -69,7 +69,11 @@ class UserController extends BaseController */ public function store(StoreUserRequest $request) { - // + //save user + + + //attach user to company + } /** diff --git a/app/Http/Requests/User/StoreUserRequest.php b/app/Http/Requests/User/StoreUserRequest.php index 489a0ed05061..7b2bb17df96d 100644 --- a/app/Http/Requests/User/StoreUserRequest.php +++ b/app/Http/Requests/User/StoreUserRequest.php @@ -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() { diff --git a/app/Http/Requests/User/UpdateUserRequest.php b/app/Http/Requests/User/UpdateUserRequest.php index ae3ad7e3b4e2..377fb4baa65c 100644 --- a/app/Http/Requests/User/UpdateUserRequest.php +++ b/app/Http/Requests/User/UpdateUserRequest.php @@ -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(), + ]; + } + } \ No newline at end of file diff --git a/app/Models/Document.php b/app/Models/Document.php index 97858f49f69d..34d9ea712365 100644 --- a/app/Models/Document.php +++ b/app/Models/Document.php @@ -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(); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 5f92ed956a2a..08f0e43f76ab 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -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() {