Your Shop creates, verify user
This commit is contained in:
parent
c129a44383
commit
ccc2af4bf7
76 changed files with 3728 additions and 1477 deletions
|
|
@ -4,8 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
|
||||
|
||||
use App\Http\Controllers\Api\KasController;
|
||||
use App\Models\Account;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
|
@ -31,23 +30,6 @@ class AdminUserController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$kas = new KasController();
|
||||
$pra = array(
|
||||
'subdomain_name' => 'test',
|
||||
'domain_name' => 'mivita.care',
|
||||
'subdomain_path' => '/mein.mivita.care/public/',
|
||||
//'php_version' => '7.1',
|
||||
//'ssl_proxy' => 'Y',
|
||||
//'redirect_status' => 0
|
||||
|
||||
|
||||
);
|
||||
//add_subdomain
|
||||
$req = $kas->action('get_subdomains');
|
||||
//"is_active"]=> string(1) "Y" ["in_progress"
|
||||
|
||||
var_dump($req);
|
||||
die();
|
||||
$data = [
|
||||
//'values' => User::where('admin', 0)->get(),
|
||||
'values' => User::where('confirmation_code_remider', '!=', 2)->get(),
|
||||
|
|
@ -58,10 +40,10 @@ class AdminUserController extends Controller
|
|||
public function edit($user_id)
|
||||
{
|
||||
$user = User::findOrFail($user_id);
|
||||
/*if(!$user->account){
|
||||
$user->account = new Account();
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
*/
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class DataTableController extends Controller
|
|||
return view('datatable');
|
||||
}
|
||||
|
||||
/*public function getLeads()
|
||||
public function getLeads()
|
||||
{
|
||||
|
||||
$query = User::where('deleted_at', '=', null);
|
||||
|
|
@ -34,11 +34,15 @@ class DataTableController extends Controller
|
|||
->addColumn('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('agreement', function (User $user) {
|
||||
return $user->agreement ? '<span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
})
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
->rawColumns(['action', 'confirmed', 'active'])
|
||||
->orderColumn('agreement', 'agreement $1')
|
||||
->rawColumns(['action', 'confirmed', 'active', 'agreement'])
|
||||
->make(true);
|
||||
}*/
|
||||
}
|
||||
|
||||
public function getUsers()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ class HomeController extends Controller
|
|||
if($data == "imprint"){
|
||||
$response = view('legal.imprint_de')->render();
|
||||
}
|
||||
if($data == "shop_term_of_use"){
|
||||
$response = view('legal.shop_term_of_use_de')->render();
|
||||
}
|
||||
if(Request::ajax()) {
|
||||
return response()->json(['response' => $response, 'target'=>$target]);
|
||||
}
|
||||
|
|
@ -117,4 +120,64 @@ class HomeController extends Controller
|
|||
{
|
||||
return view('legal.imprint');
|
||||
}
|
||||
public function verify($confirmation_code){
|
||||
if( ! $confirmation_code)
|
||||
{
|
||||
return redirect('/status/error');
|
||||
}
|
||||
|
||||
$user = User::whereConfirmationCode($confirmation_code)->first();
|
||||
|
||||
if ( ! $user)
|
||||
{
|
||||
|
||||
return redirect('/status/not/found');
|
||||
}
|
||||
|
||||
$user->confirmed = 1;
|
||||
$user->confirmation_date = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
|
||||
//Login!
|
||||
Auth::login($user);
|
||||
|
||||
return redirect('/status/verify');
|
||||
}
|
||||
|
||||
public function statusRegister(){
|
||||
return view('status.status_register');
|
||||
}
|
||||
public function statusVerify(){
|
||||
return view('status.status_verify');
|
||||
}
|
||||
public function statusError(){
|
||||
return view('status.status_error');
|
||||
}
|
||||
public function notFound(){
|
||||
return view('status.not_found');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function checkMail(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['user_id'] == "new"){
|
||||
if(User::where('email', $data['email'])->count()){
|
||||
return json_encode(false);
|
||||
}
|
||||
}else{
|
||||
if(User::where('email', $data['email'])->where('id', '!=', $data['user_id'])->count()){
|
||||
return json_encode(false);
|
||||
}
|
||||
}
|
||||
return json_encode(true);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
141
app/Http/Controllers/LeadController.php
Executable file
141
app/Http/Controllers/LeadController.php
Executable file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
|
||||
use App\Mail\MailVerifyContact;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Input;
|
||||
use Illuminate\Http\Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
||||
class LeadController extends Controller
|
||||
{
|
||||
protected $userRepo;
|
||||
|
||||
public function __construct(UserRepository $userRepo)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->userRepo = $userRepo;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'values' => User::where('admin', '=', 0)->where('confirmation_code_remider', '!=', 2)->get(),
|
||||
];
|
||||
return view('admin.leads', $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
if($id == "new"){
|
||||
$user = new User();
|
||||
$user->account = new UserAccount();
|
||||
}else{
|
||||
$user = User::findOrFail($id);
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'user' => $user,
|
||||
'can_change_mail' => true,
|
||||
];
|
||||
return view('admin.lead_edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = Input::all();
|
||||
|
||||
if ($data['user_id'] == "new") {
|
||||
$user = new User();
|
||||
$user->id = "new";
|
||||
$user->account = new UserAccount();
|
||||
$user->account->company_country_id = isset($data['company_country_id']) ? $data['company_country_id'] : 0;
|
||||
$user->account->salutation = isset($data['salutation']) ? $data['salutation'] : 0;
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'last_name' => 'required|max:255',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
'email-confirm' => 'required|same:email',
|
||||
);
|
||||
|
||||
} else {
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'last_name' => 'required|max:255',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'email' => 'required|string|email|max:255|exists:users,email',
|
||||
'email-confirm' => 'required|same:email',
|
||||
);
|
||||
}
|
||||
|
||||
if(Input::get('company') == 1){
|
||||
$rules['company_name'] = 'required|max:255';
|
||||
$rules['company_country_id'] = 'required|integer|min:1';
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return view('admin.lead_edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
$data = Input::all();
|
||||
$this->userRepo->update(Input::all());
|
||||
|
||||
if(isset($data['contact_verify'])){
|
||||
|
||||
$user = $this->userRepo->getModel();
|
||||
|
||||
$unique = false;
|
||||
do{
|
||||
$confirmation_code = str_random(30);
|
||||
if( User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
|
||||
$unique = true;
|
||||
}
|
||||
}
|
||||
while(!$unique);
|
||||
|
||||
$user->lang = $user->getLandByCountry();
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
$user->save();
|
||||
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyContact($confirmation_code, $user));
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect('/admin/leads');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,9 +64,6 @@ class UserDataController extends Controller
|
|||
|
||||
if ($validator->fails()) {
|
||||
|
||||
// get the error messages from the validator
|
||||
$messages = $validator->messages();
|
||||
// redirect our user back to the form with the errors from the validator
|
||||
return view('user.edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
|
|
@ -76,13 +73,77 @@ class UserDataController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function userDataStore(){
|
||||
|
||||
$user = Auth::user();
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'last_name' => 'required|max:255',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'email' => 'required|string|email|max:255|exists:users,email',
|
||||
'email-confirm' => 'required|same:email',
|
||||
);
|
||||
if($user->active == 0){
|
||||
$rules['accepted_data_protection'] = 'required';
|
||||
$rules['accepted_active'] = 'required';
|
||||
}
|
||||
|
||||
if(Input::get('company') == 1){
|
||||
$rules['company_name'] = 'required|max:255';
|
||||
$rules['company_country_id'] = 'required|integer|min:1';
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
// get the error messages from the validator
|
||||
$messages = $validator->messages();
|
||||
// redirect our user back to the form with the errors from the validator
|
||||
return view('user.edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
$this->userRepo->update(Input::all());
|
||||
|
||||
if($user->active == 0) {
|
||||
$account = $user->account;
|
||||
$account->data_protection = now();
|
||||
$account->save();
|
||||
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->save();
|
||||
}
|
||||
|
||||
if(Input::get('accepted_active') == "on"){
|
||||
$user->agreement = now();
|
||||
}else{
|
||||
$user->agreement = null;
|
||||
}
|
||||
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect('/home');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function userDataAcceptedForm(){
|
||||
$user = Auth::user();
|
||||
|
||||
if(Input::get('sender_accepted_infos') == "on"){
|
||||
if(Input::get('accepted_active') == "on"){
|
||||
$user->agreement = now();
|
||||
}else {
|
||||
$user->agreement = null;
|
||||
|
|
@ -93,4 +154,59 @@ class UserDataController extends Controller
|
|||
return redirect('/home');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function userDataFree(){
|
||||
$user = Auth::user();
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->save();
|
||||
return redirect('/home');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function userDataFreeForm(){
|
||||
$user = Auth::user();
|
||||
|
||||
$rules = array(
|
||||
'accepted_data_protection' => 'required'
|
||||
);
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
// get the error messages from the validator
|
||||
$messages = $validator->messages();
|
||||
// redirect our user back to the form with the errors from the validator
|
||||
return view('home', $data)->withErrors($validator);
|
||||
} else {
|
||||
$account = $user->account;
|
||||
$account->data_protection = now();
|
||||
$account->save();
|
||||
|
||||
if(Input::get('accepted_active') == "on"){
|
||||
$user->agreement = now();
|
||||
}else{
|
||||
$user->agreement = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->save();
|
||||
|
||||
}
|
||||
return redirect('/home');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
273
app/Http/Controllers/UserShopController.php
Executable file
273
app/Http/Controllers/UserShopController.php
Executable file
|
|
@ -0,0 +1,273 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Api\KasController;
|
||||
use App\Models\UserShop;
|
||||
use App\Repositories\UserRepository;
|
||||
use Auth;
|
||||
use Input;
|
||||
use Response;
|
||||
use Validator;
|
||||
|
||||
|
||||
class UserShopController extends Controller
|
||||
{
|
||||
protected $db;
|
||||
protected $userRepo;
|
||||
|
||||
public function __construct(UserRepository $userRepo)
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
return view('user.shop', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$data = Input::all();
|
||||
|
||||
if(!$user->shop){
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$user->shop->title = $data['title'];;
|
||||
$user->shop->copy = $data['copy'];
|
||||
$user->shop->info = $data['info'];
|
||||
$user->shop->active = isset($data['active']) ? true : false;
|
||||
$user->shop->save();
|
||||
\Session()->flash('alert-save', true);
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
return view('user.shop', $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Upload FILE -----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function uploadImage(){
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
if(!$user->shop){
|
||||
abort(404);
|
||||
}
|
||||
|
||||
try {
|
||||
$image = \App\Services\Slim::getImages('images')[0];
|
||||
|
||||
if ( isset($image['output']['data']) )
|
||||
{
|
||||
// Base64 of the image
|
||||
$data = $image['output']['data'];
|
||||
$file_ex = array( 'image/jpeg' => 'jpg', 'image/png' => 'png');
|
||||
|
||||
if (!isset($file_ex[$image['output']['type']])) {
|
||||
\Session()->flash('alert-danger', 'File is not jpg or png!');
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
|
||||
$ext = $file_ex[$image['output']['type']];
|
||||
// Original file name
|
||||
$name = $image['output']['name'];
|
||||
$name = \App\Services\Slim::sanitizeFileName($name);
|
||||
$name = uniqid() . '_' . $name;
|
||||
|
||||
$data = \Storage::disk('public')->put(
|
||||
'images/shop/'.$name,
|
||||
$data
|
||||
);
|
||||
|
||||
$user->shop->filename = $name;
|
||||
$user->shop->originalname = $image['output']['name'];
|
||||
$user->shop->ext = $ext;
|
||||
$user->shop->mine = $image['output']['type'];
|
||||
$user->shop->size = $image['input']['size'];
|
||||
$user->shop->save();
|
||||
|
||||
|
||||
|
||||
\Session()->flash('alert-success', "Datei hochgeladen");
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei leer");
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
catch (Exception $e) {
|
||||
\Session()->flash('alert-danger', "Fehler".$e);
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteImage(){
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
if(!$user->shop){
|
||||
abort(404);
|
||||
}
|
||||
|
||||
if($user->shop->filename){
|
||||
$file = 'images/shop/'.$user->shop->filename;
|
||||
\Storage::disk('public')->delete($file);
|
||||
|
||||
$user->shop->filename = null;
|
||||
$user->shop->originalname = null;
|
||||
$user->shop->ext = null;
|
||||
$user->shop->mine = null;
|
||||
$user->shop->size = null;
|
||||
$user->shop->save();
|
||||
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei nicht gefunden");
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function userShopRegisterForm(){
|
||||
|
||||
|
||||
if(Input::get('shop_submit') == 'check'){
|
||||
$rules = array(
|
||||
'user_shop_name' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
\Session()->flash('shop-name-error', 'error');
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
\Session()->flash('shop-name-error', 'check');
|
||||
return redirect(route('user_shop'))->withInput();
|
||||
}
|
||||
|
||||
if(Input::get('shop_submit') == 'action') {
|
||||
|
||||
$rules = array(
|
||||
'user_shop_name' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
\Session()->flash('shop-name-error', 'error');
|
||||
}else{
|
||||
\Session()->flash('shop-name-error', 'check');
|
||||
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
'user_shop_active' => 'accepted',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
//all is right - save
|
||||
$user = Auth::user();
|
||||
$data = Input::all();
|
||||
|
||||
$user_shop = UserShop::create([
|
||||
'user_id' => $user->id,
|
||||
'name' => $data['user_shop_name'],
|
||||
'active' => true,
|
||||
'active_date' => now(),
|
||||
]
|
||||
);
|
||||
|
||||
$ret = $this->userShopRegisterSubDomain($user_shop->slug);
|
||||
if($ret['success'] === true){
|
||||
\Session()->flash('alert-save', true);
|
||||
}else{
|
||||
$user_shop->forceDelete();
|
||||
\Session()->flash('alert-error', $ret['error']);
|
||||
}
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function userShopRegisterSubDomain($slug){
|
||||
|
||||
$kas = new KasController();
|
||||
$domain = 'mivita.care';
|
||||
//check if exisist
|
||||
$subdomains = $kas->action('get_subdomains');
|
||||
foreach ($subdomains as $subdomain){
|
||||
$sub = str_replace(".".$domain, '', $subdomain['subdomain_name']);
|
||||
if($sub == $slug){
|
||||
return ['success' => false, 'error' => 'Fehler: Subdomain existierts bereits, bitte einen neues Namen wählen'];
|
||||
}
|
||||
}
|
||||
//add
|
||||
$full_subdomain_name = $slug.".".$domain;
|
||||
$pra = array(
|
||||
'subdomain_name' => $slug,
|
||||
'domain_name' => $domain,
|
||||
'subdomain_path' => '/mein.mivita.care/public/',
|
||||
//'php_version' => '7.1',
|
||||
//'ssl_proxy' => 'Y',
|
||||
//'redirect_status' => 0
|
||||
);
|
||||
$add_subdomain = $kas->action('add_subdomain', $pra);
|
||||
if($add_subdomain == $full_subdomain_name){
|
||||
return ['success' => true];
|
||||
}
|
||||
return ['success' => false, 'error' => $add_subdomain];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string to ajax
|
||||
*/
|
||||
public function checkUserShopName(){
|
||||
|
||||
$rules = array(
|
||||
'user_shop_name' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$messages = $validator->messages();
|
||||
|
||||
return Response::json(array(
|
||||
'success' => false,
|
||||
'errors' => $validator->getMessageBag()->toArray()
|
||||
|
||||
));
|
||||
}
|
||||
return Response::json(array(
|
||||
'success' => true,
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -70,9 +70,7 @@ class UserUpdateEmailController extends Controller
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* public function adminChangeMail($user_id)
|
||||
public function adminChangeMail($user_id)
|
||||
{
|
||||
if(!Auth::user()->isAdmin()){
|
||||
abort(404);
|
||||
|
|
@ -122,7 +120,7 @@ class UserUpdateEmailController extends Controller
|
|||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -74,9 +74,14 @@ class SiteController extends Controller
|
|||
}
|
||||
|
||||
if($subsite){
|
||||
if(!view()->exists('web.templates.'.$subsite)){
|
||||
abort(404);
|
||||
}
|
||||
return view('web.templates.'.$subsite);
|
||||
}
|
||||
|
||||
if(!view()->exists('web.templates.'.$site)){
|
||||
abort(404);
|
||||
}
|
||||
return view('web.templates.'.$site);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,20 +29,23 @@ class MailActivateUser extends Mailable
|
|||
{
|
||||
$salutation = __('Dear customer').",";
|
||||
|
||||
/*if($this->user->account){
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
$salutation = __('Dear Sir')." ".$this->user->account->last_name.",";
|
||||
}else{
|
||||
$salutation = __('Dear Mrs')." ".$this->user->account->last_name.",";
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return $this->view('emails.auth')->with([
|
||||
'url' => route('user_update_email_confirm', $this->token),
|
||||
'salutation' => $salutation,
|
||||
'button' => __('Change E-Mail'),
|
||||
'copy1line' => __('Dear Customer you will receive this e-mail because we have received a request to change your E-Mail Address for your account.'),
|
||||
'copy2line' => __('Or copy this link into the address bar of your browser.'),
|
||||
'copy3line' => __('For further questions we are happy to help you.'),
|
||||
'greetings' => __('Best regards'),
|
||||
'sender' => __('your mivita.care team'),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,20 +28,23 @@ class MailResetPassword extends Mailable
|
|||
public function build()
|
||||
{
|
||||
$salutation = __('Dear customer').",";
|
||||
/*if($this->user->account){
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
$salutation = __('Dear Sir')." ".$this->user->account->last_name.",";
|
||||
}else{
|
||||
$salutation = __('Dear Mrs')." ".$this->user->account->last_name.",";
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return $this->view('emails.auth')->with([
|
||||
'url' => route('password.reset', $this->token),
|
||||
'salutation' => $salutation,
|
||||
'button' => __('Reset Password'),
|
||||
'copy1line' => __('Dear Customer you will receive this e-mail because we have received a request to reset the password for your account.'),
|
||||
'copy2line' => __('Or copy this link into the address bar of your browser.'),
|
||||
'copy3line' => __('For further questions we are happy to help you.'),
|
||||
'greetings' => __('Best regards'),
|
||||
'sender' => __('your mivita.care team'),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ class MailVerifyAccount extends Mailable
|
|||
public function build()
|
||||
{
|
||||
$salutation = __('Dear customer').",";
|
||||
/*if($this->user->account){
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
$salutation = __('Dear Sir')." ".$this->user->account->last_name.",";
|
||||
}else{
|
||||
$salutation = __('Dear Mrs')." ".$this->user->account->last_name.",";
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return $this->view('emails.auth')->with([
|
||||
'url' => route('register_verify', $this->confirmation_code),
|
||||
|
|
@ -42,7 +42,10 @@ class MailVerifyAccount extends Mailable
|
|||
'button' => __('Verify Your Email Address'),
|
||||
'copy1line' => __('Thank you for creating an account with the JACKON Infomanager. Please follow the link below to confirm your email address.'),
|
||||
'copy2line' => __('Or copy this link into the address bar of your browser.'),
|
||||
'copy3line' => __('For further questions we are happy to help you.'),
|
||||
'greetings' => __('Best regards'),
|
||||
'sender' => __('your mivita.care team'),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ class MailVerifyContact extends Mailable
|
|||
public function build()
|
||||
{
|
||||
$salutation = __('Dear customer').",";
|
||||
/*if($this->user->account){
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
$salutation = __('Dear Sir')." ".$this->user->account->last_name.",";
|
||||
}else{
|
||||
$salutation = __('Dear Mrs')." ".$this->user->account->last_name.",";
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return $this->view('emails.auth')->with([
|
||||
'url' => route('register_verify', $this->confirmation_code),
|
||||
|
|
@ -42,7 +42,10 @@ class MailVerifyContact extends Mailable
|
|||
'button' => __('Verify your Data and E-Mail Address'),
|
||||
'copy1line' => __('We have data about you stored in our JACKON Infomanager. Please follow the link below to verify your email address.You can also change or delete your data.'),
|
||||
'copy2line' => __('Or copy this link into the address bar of your browser.'),
|
||||
'copy3line' => __('For further questions we are happy to help you.'),
|
||||
'greetings' => __('Best regards'),
|
||||
'sender' => __('your mivita.care team'),
|
||||
|
||||
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,134 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
/**
|
||||
* App\Models\Account
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $company
|
||||
* @property string|null $company_name
|
||||
* @property string|null $company_street
|
||||
* @property string|null $company_postal_code
|
||||
* @property string|null $company_city
|
||||
* @property int|null $company_pre_phone_id
|
||||
* @property string|null $company_phone
|
||||
* @property string|null $company_homepage
|
||||
* @property int|null $company_country_id
|
||||
* @property string|null $salutation
|
||||
* @property string|null $title
|
||||
* @property string|null $first_name
|
||||
* @property string|null $last_name
|
||||
* @property string|null $street
|
||||
* @property string|null $postal_code
|
||||
* @property string|null $city
|
||||
* @property int|null $country_id
|
||||
* @property int|null $pre_phone_id
|
||||
* @property string|null $phone
|
||||
* @property int|null $pre_mobil_id
|
||||
* @property string|null $mobil
|
||||
* @property string|null $birthday
|
||||
* @property string|null $website
|
||||
* @property string|null $facebook
|
||||
* @property string|null $facebook_fanpage
|
||||
* @property string|null $instagram
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property-read \App\Models\Country|null $company_country
|
||||
* @property-read \App\Models\Country|null $company_pre_phone
|
||||
* @property-read \App\Models\Country|null $country
|
||||
* @property-read \App\Models\Country|null $pre_mobil
|
||||
* @property-read \App\Models\Country|null $pre_phone
|
||||
* @property-read \App\User $user
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account onlyTrashed()
|
||||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereBirthday($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompany($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyCity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyHomepage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyPhone($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyPostalCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyPrePhoneId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyStreet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereFacebook($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereFacebookFanpage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereFirstName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereInstagram($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereLastName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereMobil($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePhone($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePostalCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePreMobilId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePrePhoneId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereSalutation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereStreet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereWebsite($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Account extends Model
|
||||
{
|
||||
protected $table = 'accounts';
|
||||
|
||||
|
||||
use SoftDeletes;
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
|
||||
public function company_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'company_country_id');
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'country_id');
|
||||
}
|
||||
|
||||
public function company_pre_phone()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'company_pre_phone_id');
|
||||
}
|
||||
|
||||
public function pre_phone()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'pre_phone_id');
|
||||
}
|
||||
|
||||
public function pre_mobil()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'pre_mobil_id');
|
||||
}
|
||||
|
||||
public function getCompanyAttribute(){
|
||||
|
||||
if(empty($this->attributes['company']) && @$this->attributes['company'] !== 0){
|
||||
return 1;
|
||||
}
|
||||
return $this->attributes['company'];
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @mixin \Eloquent
|
||||
* @property string|null $slug
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute query()
|
||||
*/
|
||||
class Attribute extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ use Cviebrock\EloquentSluggable\Sluggable;
|
|||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductCategory[] $product_categories
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category query()
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ use PHPUnit\Framework\Constraint\Count;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country wherePhone($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereRu($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country query()
|
||||
*/
|
||||
class Country extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property string|null $slug
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product query()
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
|
|
@ -134,34 +137,6 @@ class Product extends Model
|
|||
return $this->hasMany('App\Models\ProductImage', 'product_id', 'id');
|
||||
}
|
||||
|
||||
/*
|
||||
public function isImageAfter(){
|
||||
if(empty($this->attributes['filename_after']) || @$this->attributes['filename_after'] == null || @$this->attributes['filename_after'] == ""){
|
||||
return false;
|
||||
}
|
||||
if(!\Storage::disk('public')->has('images/'.$this->id.'/'.$this->filename_after)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function getImage($file){
|
||||
|
||||
if($file == "before" && $this->isImageBefore()){
|
||||
$link = 'images/'.$this->id.'/'.$this->filename_before;
|
||||
return '/storage/'.$link.'?=lm='.\Storage::disk('public')->lastModified($link);
|
||||
}
|
||||
|
||||
if($file == "after" && $this->isImageAfter()){
|
||||
$link = 'images/'.$this->id.'/'.$this->filename_after;
|
||||
return '/storage/'.$link.'?=lm='.\Storage::disk('public')->lastModified($link);
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public function _format_number($value){
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute query()
|
||||
*/
|
||||
class ProductAttribute extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory query()
|
||||
*/
|
||||
class ProductCategory extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property string|null $slug
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage query()
|
||||
*/
|
||||
class ProductImage extends Model
|
||||
{
|
||||
|
|
|
|||
96
app/Models/UserAccount.php
Normal file
96
app/Models/UserAccount.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
/**
|
||||
* App\Models\UserAccount
|
||||
*
|
||||
* @property-read \App\Models\Country $company_country
|
||||
* @property-read \App\Models\Country $company_pre_phone
|
||||
* @property-read \App\Models\Country $country
|
||||
* @property mixed $birthday
|
||||
* @property-read mixed $company
|
||||
* @property-read \App\Models\Country $pre_mobil
|
||||
* @property-read \App\Models\Country $pre_phone
|
||||
* @property-read \App\User $user
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserAccount onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount query()
|
||||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserAccount withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserAccount withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserAccount extends Model
|
||||
{
|
||||
protected $table = 'user_accounts';
|
||||
|
||||
|
||||
use SoftDeletes;
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('App\User', 'account_id');
|
||||
}
|
||||
|
||||
|
||||
public function company_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'company_country_id');
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'country_id');
|
||||
}
|
||||
|
||||
public function company_pre_phone()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'company_pre_phone_id');
|
||||
}
|
||||
|
||||
public function pre_phone()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'pre_phone_id');
|
||||
}
|
||||
|
||||
public function pre_mobil()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'pre_mobil_id');
|
||||
}
|
||||
|
||||
public function getCompanyAttribute(){
|
||||
|
||||
if(empty($this->attributes['company']) && @$this->attributes['company'] !== 0){
|
||||
return 1;
|
||||
}
|
||||
return $this->attributes['company'];
|
||||
}
|
||||
|
||||
public function getBirthdayAttribute($value)
|
||||
{
|
||||
if(!$value){
|
||||
return "";
|
||||
}
|
||||
return Carbon::parse($value)->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
|
||||
public function setBirthdayAttribute( $value ) {
|
||||
$this->attributes['birthday'] = (new Carbon($value))->format('Y-m-d');
|
||||
}
|
||||
|
||||
public function getDataProtectionFormat(){
|
||||
if(!$this->attributes['data_protection']){ return ""; }
|
||||
return Carbon::parse($this->attributes['data_protection'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
}
|
||||
98
app/Models/UserShop.php
Normal file
98
app/Models/UserShop.php
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Http\Controllers\Api\KasController;
|
||||
use Carbon\Carbon;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class UserShop extends Model
|
||||
{
|
||||
protected $table = 'user_shops';
|
||||
protected $is_online = NULL;
|
||||
|
||||
protected $casts = [
|
||||
'trans_title' => 'array',
|
||||
'trans_copy' => 'array',
|
||||
'trans_info' => 'array',
|
||||
'featured' => 'array',
|
||||
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id', 'name', 'active', 'active_date',
|
||||
];
|
||||
|
||||
use SoftDeletes;
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
use Sluggable;
|
||||
public function sluggable()
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'name'
|
||||
]
|
||||
];
|
||||
}
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User', 'user_id');
|
||||
}
|
||||
|
||||
public function getActiveDateFormat(){
|
||||
if(!$this->attributes['active_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['active_date'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
|
||||
public function getSubdomain()
|
||||
{
|
||||
return config('app.protocol').$this->attributes['slug'].".".config('app.domain');
|
||||
}
|
||||
|
||||
public function getSubdomainStatus()
|
||||
{
|
||||
if($this->is_online != NULL){
|
||||
return $this->is_online;
|
||||
}
|
||||
|
||||
$kas = new KasController();
|
||||
$domain = 'mivita.care';
|
||||
$pra = array(
|
||||
'subdomain_name' => $this->attributes['slug'].".".$domain,
|
||||
'domain_name' => $this->attributes['slug'].".".$domain,
|
||||
);
|
||||
|
||||
//check if exisist
|
||||
$subdomain = $kas->action('get_subdomains', $pra);
|
||||
if(!empty($subdomain[0]['is_active']) && $subdomain[0]['is_active'] == 'Y'){
|
||||
$this->is_online = true;
|
||||
return true;
|
||||
}
|
||||
$this->is_online = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function isImage(){
|
||||
if(empty($this->attributes['filename']) || @$this->attributes['filename'] == null || @$this->attributes['filename'] == ""){
|
||||
return false;
|
||||
}
|
||||
if(!\Storage::disk('public')->has('images/shop/'.$this->filename)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getImage(){
|
||||
if($this->isImage()){
|
||||
$link = 'images/shop/'.$this->filename;
|
||||
return '/storage/'.$link.'?=lm='.\Storage::disk('public')->lastModified($link);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,10 +9,13 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*
|
||||
* @property-read \App\User $user
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail query()
|
||||
*/
|
||||
class UserUpdateEmail extends Model
|
||||
{
|
||||
protected $table = 'users_update_email';
|
||||
protected $table = 'user_update_emails';
|
||||
|
||||
protected $fillable = [
|
||||
'user_id', 'email', 'token',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\UserAccount;
|
||||
use App\User;
|
||||
|
||||
|
||||
|
|
@ -14,10 +15,7 @@ class UserRepository extends BaseRepository {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* refresh.
|
||||
*/
|
||||
/*public function update($data)
|
||||
public function update($data)
|
||||
{
|
||||
|
||||
if($data['user_id'] == "new"){
|
||||
|
|
@ -40,17 +38,15 @@ class UserRepository extends BaseRepository {
|
|||
$account->company = $data['company'];
|
||||
|
||||
$account->company_name = $data['company_name'];
|
||||
|
||||
$account->company_street = $data['company_street'];
|
||||
$account->company_postal_code = $data['company_postal_code'];
|
||||
$account->company_city = $data['company_city'];
|
||||
$account->company_country_id = isset($data['company_country_id']) ? $data['company_country_id'] : null;
|
||||
|
||||
$account->company_pre_phone_id = isset($data['company_pre_phone_id']) ? $data['company_pre_phone_id']: null;
|
||||
$account->company_phone = $data['company_phone'];
|
||||
$account->company_homepage = $data['company_homepage'];
|
||||
|
||||
|
||||
$account->position_text = $data['position_text'];
|
||||
$account->salutation = $data['salutation'];
|
||||
$account->title = $data['title'];
|
||||
$account->first_name = $data['first_name'];
|
||||
|
|
@ -67,7 +63,11 @@ class UserRepository extends BaseRepository {
|
|||
$account->pre_mobil_id = isset($data['pre_mobil_id']) ? $data['pre_mobil_id']: null;
|
||||
$account->mobil = $data['mobil'];
|
||||
|
||||
$account->contactpartner = $data['contactpartner'];
|
||||
$account->birthday = $data['birthday'];
|
||||
$account->website = $data['website'];
|
||||
$account->instagram = $data['instagram'];
|
||||
$account->facebook = $data['facebook'];
|
||||
$account->facebook_fanpage = $data['facebook_fanpage'];
|
||||
|
||||
//data_protection
|
||||
//active_date
|
||||
|
|
@ -79,14 +79,9 @@ class UserRepository extends BaseRepository {
|
|||
$this->model->save();
|
||||
}
|
||||
|
||||
$this->updateInterests(isset($data['interests']) ? $data['interests'] : array());
|
||||
$this->updateIndustrySector(isset($data['industry_sectors']) ? $data['industry_sectors'] : array());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public function deleteUser(User $user)
|
||||
{
|
||||
if($user->account){
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ namespace App\Services;
|
|||
|
||||
use App\Models\Attribute;
|
||||
use App\Models\Category;
|
||||
use App\Models\Country;
|
||||
|
||||
class HTMLHelper
|
||||
{
|
||||
|
|
@ -134,7 +135,7 @@ class HTMLHelper
|
|||
}
|
||||
|
||||
|
||||
/* public static function getCompanyOptions($company){
|
||||
public static function getCompanyOptions($company){
|
||||
$options = array(1 => __('business'), 0 => __('private'), );
|
||||
$ret = "";
|
||||
foreach ($options as $id => $value){
|
||||
|
|
@ -143,21 +144,6 @@ class HTMLHelper
|
|||
}
|
||||
return $ret;
|
||||
}
|
||||
public static function getIndustrySectorsWithoutParents($id = false, $sameId = false, $all = true){
|
||||
$values = IndustrySector::where('parent_id', null)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if($sameId == $value->id){
|
||||
continue;
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getContriesWithMore($id, $all=true){#
|
||||
$values = Country::all();
|
||||
|
|
@ -219,5 +205,27 @@ class HTMLHelper
|
|||
$values = array('mr' => __('MR'), 'ms' => __('MS'));
|
||||
return (!empty($values[$id]) ? $values[$id] : '');
|
||||
}
|
||||
|
||||
/*public static function getIndustrySectorsWithoutParents($id = false, $sameId = false, $all = true){
|
||||
$values = IndustrySector::where('parent_id', null)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if($sameId == $value->id){
|
||||
continue;
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
@ -206,6 +206,9 @@ class Slim {
|
|||
$str = preg_replace('([^\w\s\d\-_~,;\[\]\(\).])', '', $str);
|
||||
// Remove any runs of periods
|
||||
$str = preg_replace('([\.]{2,})', '', $str);
|
||||
|
||||
$str = (strlen($str) > 33) ? substr($str,-33) : $str;
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
|
|
|||
17
app/User.php
17
app/User.php
|
|
@ -64,6 +64,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereNotes($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\User withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\User withoutTrashed()
|
||||
* @property int|null $account_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereAccountId($value)
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
@ -94,11 +99,17 @@ class User extends Authenticatable
|
|||
];
|
||||
|
||||
|
||||
public function account()
|
||||
public function account()
|
||||
{
|
||||
return $this->hasOne('App\Models\Account');
|
||||
return $this->belongsTo('App\Models\UserAccount', 'account_id');
|
||||
}
|
||||
|
||||
public function shop()
|
||||
{
|
||||
return $this->hasOne('App\Models\UserShop', 'user_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
|
@ -182,7 +193,7 @@ class User extends Authenticatable
|
|||
return 'de';
|
||||
}
|
||||
}
|
||||
return "en";
|
||||
return "de";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue