01 2020
This commit is contained in:
parent
f117f79bb9
commit
3711fcc8d0
101 changed files with 4027 additions and 918 deletions
|
|
@ -125,11 +125,11 @@ class PayoneController extends Controller
|
|||
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
foreach ($shopping_order_item->product->action as $do){
|
||||
if($shopping_order_item->product->getActionName($do) == 'payment_for_account'){
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_account'){
|
||||
$user->payment_account = date("Y-m-d H:i:s", strtotime("+1 years"));
|
||||
$user->wizard = 10;
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) == 'payment_for_shop'){
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_shop'){
|
||||
$user->payment_shop = date("Y-m-d H:i:s", strtotime("+1 years"));
|
||||
$user->wizard = 10;
|
||||
}
|
||||
|
|
@ -144,6 +144,7 @@ class PayoneController extends Controller
|
|||
if($data['txaction'] == 'appointed'){
|
||||
|
||||
}
|
||||
|
||||
$billing_email = $shopping_order->shopping_user->billing_email;
|
||||
$user_shop_email = $shopping_order->user_shop->user->email;
|
||||
if(!$billing_email){
|
||||
|
|
|
|||
|
|
@ -25,25 +25,25 @@ class DataTableController extends Controller
|
|||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('admin', function (User $user) {
|
||||
return '<a href="#" data-toggle="modal" data-target="#modals-default" data-id="'.$user->id.'" data-email="'.$user->email.'" data-admin="'.$user->admin.'" data-active="'.$user->active.'" data-confirmed="'.$user->confirmed.'">'.HTMLHelper::getRoleLabel($user->admin).'</a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<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>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->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>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('shop', function (User $user) {
|
||||
if($user->shop){
|
||||
if($user->shop->active){
|
||||
return '<span class="badge badge-pill badge-success"><i class="far fa-check"></i> active</span>';
|
||||
return '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> active</span>';
|
||||
}
|
||||
return'<span class="badge badge-pill badge-success"><i class="far fa-check"></i> deactive</span>';
|
||||
return'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> deactive</span>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('since', function (User $user) {
|
||||
if($user->shop){
|
||||
|
|
@ -55,8 +55,8 @@ class DataTableController extends Controller
|
|||
return "-";
|
||||
})
|
||||
->addColumn('action_delete', function (User $user) {
|
||||
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="far fa-trash"></span></a>
|
||||
<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="far fa-sign-in-alt"></span></a>';
|
||||
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>
|
||||
<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="fa fa-sign-in-alt"></span></a>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ class HomeController extends Controller
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
||||
public function index()
|
||||
{
|
||||
if(!Auth::check()){
|
||||
|
|
@ -55,28 +51,28 @@ class HomeController extends Controller
|
|||
$target = Input::get('target');
|
||||
|
||||
$response = "";
|
||||
if($data == "data_protection"){
|
||||
if($data === "data_protection"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
$response = view('legal.data_protect_de', $data)->render();
|
||||
}
|
||||
if($data == "imprint"){
|
||||
if($data === "imprint"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
$response = view('legal.imprint_de', $data)->render();
|
||||
}
|
||||
if($data == "shop_term_of_use"){
|
||||
if($data === "shop_term_of_use"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
$response = view('legal.shop_term_of_use_de', $data)->render();
|
||||
}
|
||||
if($data == "agb"){
|
||||
if($data === "agb"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
|
|
@ -169,13 +165,13 @@ class HomeController extends Controller
|
|||
|
||||
if ( ! $user)
|
||||
{
|
||||
|
||||
// return redirect('/status/not/found');
|
||||
return redirect('/home');
|
||||
|
||||
return redirect('/status/not/found');
|
||||
}
|
||||
$user->confirmed = 1;
|
||||
$user->confirmation_date = now();
|
||||
if($user->confirmed === 0){
|
||||
$user->confirmed = 1;
|
||||
$user->confirmation_date = now();
|
||||
}
|
||||
|
||||
// $user->confirmation_code = null;
|
||||
// $user->confirmation_code_to = null;
|
||||
// $user->confirmation_code_remider = 0;
|
||||
|
|
@ -207,7 +203,7 @@ class HomeController extends Controller
|
|||
public function checkMail(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['user_id'] == "new"){
|
||||
if($data['user_id'] === "new"){
|
||||
if(User::where('email', $data['email'])->count()){
|
||||
return json_encode(false);
|
||||
}
|
||||
|
|
@ -228,9 +224,9 @@ class HomeController extends Controller
|
|||
|
||||
if($reference){
|
||||
$ShoppingPayment = ShoppingPayment::where('reference', $reference)->first();
|
||||
if($ShoppingPayment->status == 'success'){
|
||||
if($ShoppingPayment && $ShoppingPayment->status === 'success'){
|
||||
$user = Auth::user();
|
||||
if($user->wizard < 4){
|
||||
if($user && $user->wizard < 4){
|
||||
$user->wizard = 4;
|
||||
$user->save();
|
||||
return redirect(route('wizard', [4]));
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ namespace App\Http\Controllers;
|
|||
|
||||
|
||||
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Mail\MailVerifyContact;
|
||||
use App\Mail\MailAccountActive;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\ContractPDFRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
|
@ -58,6 +61,7 @@ class LeadController extends Controller
|
|||
}
|
||||
}
|
||||
$data = [
|
||||
'show' => Input::get('show'),
|
||||
'user' => $user,
|
||||
'can_change_mail' => true,
|
||||
'm_data_load' => false,
|
||||
|
|
@ -96,6 +100,7 @@ class LeadController extends Controller
|
|||
}
|
||||
}
|
||||
$data = [
|
||||
'show' => Input::get('show'),
|
||||
'user' => $user,
|
||||
'm_data_load' => $m_data_load,
|
||||
'm_data_error' => $m_data_error,
|
||||
|
|
@ -112,6 +117,8 @@ class LeadController extends Controller
|
|||
{
|
||||
|
||||
$data = Input::all();
|
||||
$show = Input::get('show');
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
|
|
@ -155,7 +162,7 @@ class LeadController extends Controller
|
|||
$user_id = $user->id;
|
||||
}
|
||||
return redirect(route('admin_lead_edit', [$user_id]))->withErrors($validator)->withInput(Input::all());
|
||||
}else{
|
||||
}
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$user = new User();
|
||||
|
|
@ -194,6 +201,9 @@ class LeadController extends Controller
|
|||
|
||||
$user->lang = $user->getLandByCountry();
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
//10 == start wizard form create Lead
|
||||
$user->wizard = 10;
|
||||
|
||||
$user->save();
|
||||
|
||||
|
||||
|
|
@ -204,28 +214,84 @@ class LeadController extends Controller
|
|||
}
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
return redirect(route('admin_lead_edit', [$user->id])."?show=".$show);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//user released when register is complete
|
||||
public function newReleased($id){
|
||||
|
||||
$user = User::findOrFail($id);
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
if(!$user->m_sponsor){
|
||||
$validator->errors()->add('m_sponsor', __('Berater hat keinen Sponsor.'));
|
||||
}
|
||||
if(!$user->account->m_first_name){
|
||||
$validator->errors()->add('m_first_name', __('Berater hat keinen Vornamen.'));
|
||||
}
|
||||
if(!$user->account->m_first_name){
|
||||
$validator->errors()->add('m_last_name', __('Berater hat keinen Nachnamen.'));
|
||||
}
|
||||
if(!$user->account->m_account){
|
||||
$validator->errors()->add('m_account', __('Berater hat keine Account ID'));
|
||||
}
|
||||
if ($validator->errors()->count()) {
|
||||
return back()->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
|
||||
//create PDF
|
||||
$pdf = new ContractPDFRepository($user);
|
||||
$pdf->_set('disk', 'user');
|
||||
$pdf->_set('dir', '/'.$user->id.'/documents/');
|
||||
$pdf->_set('user_id', $user->id);
|
||||
$pdf->_set('identifier', 'contract');
|
||||
$pdf->createContractPDF();
|
||||
|
||||
//set wizard tp payments
|
||||
$user->wizard = 20;
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
|
||||
//mail with code to user?
|
||||
Mail::to($user->email)->send(new MailAccountActive($user));
|
||||
\Session()->flash('alert-success', "Berater freigeschaltet!");
|
||||
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
}
|
||||
|
||||
|
||||
//send new verfified mail to user
|
||||
public function newMailVerified($id){
|
||||
|
||||
$user = User::findOrFail($id);
|
||||
$unique = false;
|
||||
do{
|
||||
$confirmation_code = str_random(30);
|
||||
if(User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
|
||||
$unique = true;
|
||||
}
|
||||
}
|
||||
while(!$unique);
|
||||
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
$user->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
\Session()->flash('alert-success', "E-Mail erneut gesendet");
|
||||
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
|
||||
}
|
||||
|
||||
/* @if($user->payment_account )
|
||||
<p><span class="ion ion-md-checkmark-circle-outline text-primary"></span>
|
||||
<strong>{{__('Account aktiv')}}</strong> {{__('bis zum:')}} {{ $user->getPaymentAccountDateFormat() }}</p>
|
||||
@else
|
||||
<p><span class="ion ion-md-close-circle-outline text-danger"></span>
|
||||
<strong>{{__('Account inaktiv')}}</strong></p>
|
||||
@endif
|
||||
|
||||
@if($user->payment_shop)
|
||||
<p><span class="ion ion-md-checkmark-circle-outline text-primary"></span>
|
||||
<strong>{{__('Shop aktiv')}}</strong> {{__('bis zum')}}: {{ $user->getPaymentShopDateFormat() }}</p>
|
||||
@else
|
||||
<p><span class="ion ion-md-close-circle-outline text-danger"></span>
|
||||
<strong>{{__('Shop inaktiv')}}</strong></p>
|
||||
@endif*/
|
||||
public function getLeads()
|
||||
{
|
||||
|
||||
|
|
@ -242,22 +308,22 @@ class LeadController extends Controller
|
|||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<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>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->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>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa 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>';
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account', function (User $user) {
|
||||
return $user->payment_account ? ' <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>';
|
||||
return $user->payment_account ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account_date', function (User $user) {
|
||||
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
|
||||
})
|
||||
->addColumn('payment_shop', function (User $user) {
|
||||
return $user->payment_shop ? ' <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>';
|
||||
return $user->payment_shop ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_shop_date', function (User $user) {
|
||||
return $user->payment_shop ? $user->getPaymentShopDateFormat(false) : "-";
|
||||
|
|
|
|||
|
|
@ -73,16 +73,16 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain().'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain().'</span>' : '';
|
||||
})
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
/* ->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<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>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->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>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa 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>';
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
|
|
@ -149,16 +149,16 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain().'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain().'</span>' : '';
|
||||
})
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
/* ->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<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>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->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>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa 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>';
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Input;
|
||||
use Validator;
|
||||
|
|
@ -86,7 +87,7 @@ class UserDataController extends Controller
|
|||
*/
|
||||
public function userDataStore(){
|
||||
|
||||
$user = Auth::user();
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ class UserUpdatePasswordController extends Controller
|
|||
// redirect our user back to the form with the errors from the validator
|
||||
return view('user.update_password')->withErrors($validator);
|
||||
|
||||
}else{
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
}
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('user_update_password'));
|
||||
|
|
@ -67,22 +67,18 @@ class UserUpdatePasswordController extends Controller
|
|||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function updatePasswordFirst(){
|
||||
if(!Auth::user()->isPasswort()){
|
||||
return view('user.update_password_first');
|
||||
}
|
||||
return redirect(route('user_update_password'));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the password for the user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function updatePasswordFirstStore(Request $request)
|
||||
{
|
||||
|
|
@ -100,12 +96,13 @@ class UserUpdatePasswordController extends Controller
|
|||
// redirect our user back to the form with the errors from the validator
|
||||
return view('user.update_password_first')->withErrors($validator);
|
||||
|
||||
}else{
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
}
|
||||
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect('/home');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,6 @@ class CheckoutController extends Controller
|
|||
return redirect(route('checkout.checkout_card'))->withInput(Input::all());
|
||||
}
|
||||
if($ret['elv']['status'] === 'APPROVED' && $ret['elv']['mandate_status'] !== "active"){
|
||||
dd($ret);
|
||||
\Session::flash('elv-managemandate', 1);
|
||||
\Session::flash('elv-mandate_identification', $ret['elv']['mandate_identification']);
|
||||
\Session::flash('elv-mandate_text', $ret['elv']['mandate_text']);
|
||||
|
|
@ -198,7 +197,7 @@ class CheckoutController extends Controller
|
|||
if(Input::get('payment_method') === 'elv' && Input::get('mandate_identification')) {
|
||||
$ret['elv']['mandate_identification'] = Input::get('mandate_identification');
|
||||
$ret['elv']['creditor_identifier'] = Input::get('creditor_identifier');
|
||||
$ret['elv']['iban'] = $data['iban'];
|
||||
$ret['elv']['iban'] = $data['elv_iban'];
|
||||
$ret['elv']['bic'] = $data['elv_bic'];
|
||||
$ret['elv']['bankaccountholder'] = $data['elv_bankaccountholder'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ class ContactController extends Controller
|
|||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
}else{
|
||||
}
|
||||
|
||||
|
||||
$contact = [];
|
||||
$contact['first_name'] = Input::get('first_name');
|
||||
|
|
@ -78,8 +79,6 @@ class ContactController extends Controller
|
|||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.contact-final', $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
135
app/Http/Controllers/Web/RegisterController.php
Executable file
135
app/Http/Controllers/Web/RegisterController.php
Executable file
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\MailContact;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use GuzzleHttp\Client;
|
||||
use Input;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Services\Util;
|
||||
use Validator;
|
||||
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
|
||||
private $GOOGLE_ReCAPTCHA_KEY = "6LeeZosUAAAAAG907fMMqO4BFgsiR4ANDodd8FlU";
|
||||
private $GOOGLE_ReCAPTCHA_SECRET = "6LeeZosUAAAAADIy2fyR4RG3EuM-Zdz7Pa2Qmb1J";
|
||||
|
||||
protected $userRepo;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function __construct(UserRepository $userRepo)
|
||||
{
|
||||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.registrierung', $data);
|
||||
|
||||
}
|
||||
|
||||
public function register(){
|
||||
|
||||
|
||||
$rules = array(
|
||||
'first_name'=>'required',
|
||||
'last_name'=>'required',
|
||||
'salutation' => 'required',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
'email-confirm' => 'required|same:email',
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
'password_confirmation' => 'required|string|min:6',
|
||||
// 'g-recaptcha-response'=>'required|recaptcha',
|
||||
'accepted_data_protection' => 'required',
|
||||
);
|
||||
|
||||
/*Validator::extend('recaptcha', function($attribute, $value, $parameters, $validator) {
|
||||
return $this->reCaptcha_validate($attribute, $value, $parameters, $validator);
|
||||
});*/
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
$data = Input::all();
|
||||
$user = $this->userRepo->create($data);
|
||||
|
||||
$unique = false;
|
||||
do{
|
||||
$confirmation_code = str_random(30);
|
||||
if(User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
|
||||
$unique = true;
|
||||
}
|
||||
}
|
||||
while(!$unique);
|
||||
|
||||
|
||||
$user->lang = !empty(\App::getLocale()) ? \App::getLocale() : "de";
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
$user->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->m_sponsor = $user_shop->user->id;
|
||||
$user->m_level = 1;
|
||||
$user->save();
|
||||
|
||||
$user->account->data_protection = now();
|
||||
$user->account->save();
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
return redirect('/registrierung/finish');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function finish()
|
||||
{
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.registrierung_finish', $data);
|
||||
}
|
||||
/*
|
||||
private function reCaptcha_validate($attribute, $value, $parameters, $validator)
|
||||
{
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$response = $client->post(
|
||||
'https://www.google.com/recaptcha/api/siteverify',
|
||||
['form_params' =>
|
||||
[
|
||||
'secret' => $this->GOOGLE_ReCAPTCHA_SECRET,
|
||||
'response' => $value
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$body = json_decode((string)$response->getBody());
|
||||
return $body->success;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -63,8 +63,8 @@ class SiteController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if($site == 'produkte'){
|
||||
if($subsite || $subsite != 'alle-produkte') {
|
||||
if($site === 'produkte'){
|
||||
if($subsite || $subsite !== 'alle-produkte') {
|
||||
$category = Category::where('slug', $subsite)->where('active', true)->first();
|
||||
if ($category) {
|
||||
$headline_image = false;
|
||||
|
|
|
|||
|
|
@ -2,35 +2,46 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Mail\MailReleaseAccount;
|
||||
use App\Models\File;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Input;
|
||||
use Validator;
|
||||
use Yard;
|
||||
|
||||
class WizardController extends Controller
|
||||
{
|
||||
|
||||
protected $fileRepo;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(FileRepository $fileRepo)
|
||||
{
|
||||
$this->fileRepo = $fileRepo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function show($step = 0)
|
||||
public function create()
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
$user = Auth::user();
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
|
|
@ -38,7 +49,7 @@ class WizardController extends Controller
|
|||
return redirect(route('wizard'));
|
||||
}
|
||||
|
||||
$step = (!$user->wizard ? 0 : $user->wizard );
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
if($step == 10){
|
||||
return redirect('/');
|
||||
}
|
||||
|
|
@ -48,18 +59,178 @@ class WizardController extends Controller
|
|||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
|
||||
return view('user.wizard.show', $data);
|
||||
return view('user.wizard.create', $data);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
|
||||
public function store($step = 0)
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
return redirect(route('wizard'));
|
||||
}
|
||||
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
|
||||
if($step == 10){
|
||||
return redirect('/');
|
||||
}
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
if($step == 5){
|
||||
return view('user.wizard.register_release', $data);
|
||||
}
|
||||
|
||||
return view('user.wizard.register', $data);
|
||||
}
|
||||
|
||||
public function storeRegister($step = false)
|
||||
{
|
||||
|
||||
if (!Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if (!$user->account) {
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
|
||||
if ($step == 0) {
|
||||
|
||||
$rules = array(
|
||||
'accepted_data_protection' => 'required',
|
||||
'accepted_active' => 'required',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
$user->wizard = 0;
|
||||
$user->save();
|
||||
return view('user.wizard.register', $data)->withErrors($validator);
|
||||
}
|
||||
$account = $user->account;
|
||||
if($account->data_protection === null){
|
||||
$account->data_protection = now();
|
||||
}
|
||||
if($user->agreement === null){
|
||||
$user->agreement = now();
|
||||
}
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
if ($step == 1) {
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'address' => 'required',
|
||||
'zipcode' => 'required',
|
||||
'city' => 'required',
|
||||
'phone' => 'required_without:mobil',
|
||||
'mobil' => 'required_without:phone',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'birthday' => 'required',
|
||||
);
|
||||
|
||||
if (!Input::get('same_as_billing')) {
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname' => 'required',
|
||||
'shipping_lastname' => 'required',
|
||||
'shipping_address' => 'required',
|
||||
'shipping_zipcode' => 'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_salutation' => 'required',
|
||||
'shipping_country_id' => 'required|integer|min:1',
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
$data = Input::all();
|
||||
$data['same_as_billing'] = Input::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$user->account->fill($data)->save();
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
|
||||
if ($step == 2) {
|
||||
if(Input::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Ausweis hinterlegt, bitte erst hochladen.'));
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
$this->fileRepo->_set('disk', 'user');
|
||||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'id_card');
|
||||
return $this->fileRepo->uploadFile(Input::all());
|
||||
}
|
||||
|
||||
if ($step == 3) {
|
||||
if(Input::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Gewerbeschein hinterlegt, bitte erst hochladen.'));
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
$user->wizard = 4;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
$this->fileRepo->_set('disk', 'user');
|
||||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'business_license');
|
||||
return $this->fileRepo->uploadFile(Input::all());
|
||||
}
|
||||
|
||||
if ($step == 4) {
|
||||
|
||||
$user->wizard = 5;
|
||||
$user->release_account = now();
|
||||
$user->save();
|
||||
Mail::to('kevin@adametz.media')->bcc(['kevin.adametz@me.com'])->send(new MailReleaseAccount($user));
|
||||
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
}
|
||||
|
||||
public function storeCreate($step = 0)
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
|
|
@ -76,6 +247,7 @@ class WizardController extends Controller
|
|||
'step' => $step,
|
||||
];
|
||||
return view('user.wizard.show', $data)->withErrors($validator);
|
||||
|
||||
}
|
||||
$account = $user->account;
|
||||
$account->data_protection = now();
|
||||
|
|
@ -207,9 +379,21 @@ class WizardController extends Controller
|
|||
\Session()->flash('alert-error', "Fehler beim Produkt");
|
||||
return redirect(route('wizard', [3]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function delete($id, $relation){
|
||||
|
||||
if($relation === 'upload'){
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
$file = $user->files()->findOrFail($id);
|
||||
//remove file
|
||||
\Storage::disk('user')->delete($file->dir.$file->filename);
|
||||
$file->delete();
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -46,15 +46,25 @@ class Authenticate
|
|||
return redirect(route('user_blocked'));
|
||||
}
|
||||
|
||||
//is wizard
|
||||
if(in_array('user', $guards) && $this->auth->user()->wizard < 5){
|
||||
return redirect(route('wizard'));
|
||||
}
|
||||
//can use wizard < 10 to repay
|
||||
if(in_array('user', $guards) && $this->auth->user()->wizard < 10){
|
||||
//return redirect(route('wizard'));
|
||||
//100 wizzard is finish
|
||||
if(in_array('user', $guards) && $this->auth->user()->wizard !== 100){
|
||||
//0-10 == start wizard form register
|
||||
if(in_array('user', $guards) && $this->auth->user()->wizard < 10){
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
//10-20 == start wizard form create Lead
|
||||
if(in_array('user', $guards) && $this->auth->user()->wizard < 20){
|
||||
return redirect(route('wizard_create'));
|
||||
}
|
||||
//is wizard
|
||||
/*if(in_array('user', $guards) && $this->auth->user()->wizard < 5){
|
||||
return redirect(route('wizard'));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
29
app/Libraries/ContractPDF.php
Normal file
29
app/Libraries/ContractPDF.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
namespace App\Libraries;
|
||||
|
||||
|
||||
|
||||
use setasign\Fpdi\Fpdi;
|
||||
|
||||
class ContractPDF extends Fpdi
|
||||
{
|
||||
protected $_tplIdx;
|
||||
protected $_site = 1;
|
||||
|
||||
public function Header()
|
||||
{
|
||||
if (null === $this->_tplIdx) {
|
||||
$this->setSourceFile('./pdf/mivita_template_contract_de.pdf');
|
||||
}
|
||||
$this->_tplIdx = $this->importPage($this->_site++);
|
||||
$this->useTemplate($this->_tplIdx);
|
||||
|
||||
}
|
||||
|
||||
function Footer() {
|
||||
|
||||
} // end of footer
|
||||
|
||||
|
||||
|
||||
}
|
||||
48
app/Mail/MailAccountActive.php
Normal file
48
app/Mail/MailAccountActive.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailAccountActive extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $confirmation_code;
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->subject = __('email.account_active');
|
||||
}
|
||||
|
||||
|
||||
public function build()
|
||||
{
|
||||
$salutation = __('email.salutation').",";
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation === "mr"){
|
||||
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
|
||||
}else{
|
||||
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
|
||||
}
|
||||
}
|
||||
return $this->view('emails.auth')->with([
|
||||
'url' => route('login'),
|
||||
'salutation' => $salutation,
|
||||
'button' => __('Login'),
|
||||
'copy1line' => __('email.account_active_copy1line'),
|
||||
'copy2line' => __('email.copy2line'),
|
||||
'copy3line' => __('email.copy3line'),
|
||||
'greetings' => __('email.greetings'),
|
||||
'sender' => __('email.sender'),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ class MailActivateUser extends Mailable
|
|||
use Queueable, SerializesModels;
|
||||
|
||||
protected $token;
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
public function __construct($token, User $user)
|
||||
|
|
@ -25,7 +26,7 @@ class MailActivateUser extends Mailable
|
|||
$salutation = __('email.salutation').",";
|
||||
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
if($this->user->account->salutation === "mr"){
|
||||
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
|
||||
}else{
|
||||
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class MailCheckout extends Mailable
|
|||
$salutation = __('email.hello')." ".$this->shopping_order->shopping_user->billing_firstname.",";
|
||||
//make Adresse
|
||||
}
|
||||
if($this->txaction == 'paid'){
|
||||
if($this->txaction === 'paid'){
|
||||
return $this->view('emails.checkout')->with([
|
||||
'salutation' => $salutation,
|
||||
'copy1line' => __('email.checkout_copy1line'),
|
||||
|
|
|
|||
64
app/Mail/MailReleaseAccount.php
Normal file
64
app/Mail/MailReleaseAccount.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailReleaseAccount extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->subject = 'Berater Registrierung pürfen';
|
||||
}
|
||||
|
||||
|
||||
public function build()
|
||||
{
|
||||
$content = __(strtoupper($this->user->account->salutation))." ";
|
||||
$content .= $this->user->account->first_name." ".$this->user->account->last_name."\n";
|
||||
$content .= $this->user->account->address."\n";
|
||||
$content .= $this->user->account->zipcode." ".$this->user->account->city."\n";
|
||||
$content .= $this->user->account->country_id ? $this->user->account->country->de."\n\n" : "\n\n";
|
||||
if($this->user->account->phone){
|
||||
$content .= "Telefon: ";
|
||||
$content .= $this->user->account->pre_phone_id ? $this->user->account->pre_phone->phone." " : " ";
|
||||
$content .= $this->user->account->phone;
|
||||
}
|
||||
if($this->user->account->mobil){
|
||||
$content .= "Mobil: ";
|
||||
$content .= $this->user->account->pre_mobil_id ? $this->user->account->pre_mobil->phone." " : " ";
|
||||
$content .= $this->user->account->mobil;
|
||||
}
|
||||
$content .= "E-Mail: ".$this->user->email;
|
||||
|
||||
|
||||
$copy1line = "Ein neuer Berater hat sich Registriert und wartet auf die Überprüfung und Freigabe seiner Daten."."\n";
|
||||
$copy1line .= "+ Überprüfung Ausweisdaten"."\n";
|
||||
$copy1line .= "+ Überprüfung Gewerbenachweis"."\n";
|
||||
$copy1line .= "+ Eintrag Account ID"."\n";
|
||||
$copy1line .= "+ Überprüfung Karriere-Level/Sponsor"."\n";
|
||||
$copy1line .= "+ Überprüfung Rechnungsdaten"."\n";
|
||||
|
||||
$copy1line .= 'Nach erfolgreicher Überprüfung mit dem Button "Daten vollständigt => Berater freischalten" den Berater freischalten.'."\n";
|
||||
$copy1line .= 'Der Berater erhält eine Mail, dass sein Account freigeschaltet worden ist. In den Vertrag wird automatisch mit den eingetragenden Inhalten erstellt.'."\n";
|
||||
|
||||
return $this->view('emails.info')->with([
|
||||
'url' => route('admin_lead_edit', $this->user->id).'?show=check_lead',
|
||||
'salutation' => 'Berater Registrierung pürfen',
|
||||
'button' => 'zur Berater Prüfung',
|
||||
'copy1line' => $copy1line,
|
||||
'copy2line' => __('email.copy2line'),
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ class MailResetPassword extends Mailable
|
|||
use Queueable, SerializesModels;
|
||||
|
||||
protected $token;
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ class MailResetPassword extends Mailable
|
|||
{
|
||||
$salutation = __('email.salutation').",";
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
if($this->user->account->salutation === "mr"){
|
||||
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
|
||||
}else{
|
||||
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class MailVerifyAccount extends Mailable
|
|||
use Queueable, SerializesModels;
|
||||
|
||||
protected $confirmation_code;
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
|
||||
|
|
@ -26,9 +27,8 @@ class MailVerifyAccount extends Mailable
|
|||
public function build()
|
||||
{
|
||||
$salutation = __('email.salutation').",";
|
||||
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
if($this->user->account->salutation === "mr"){
|
||||
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
|
||||
}else{
|
||||
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
|
||||
|
|
@ -39,8 +39,8 @@ class MailVerifyAccount extends Mailable
|
|||
'salutation' => $salutation,
|
||||
'button' => __('email.email_verify'),
|
||||
'copy1line' => __('email.email_verify_copy1line'),
|
||||
'copy2line' => __('email.active_copy2line'),
|
||||
'copy3line' => __('email.active_copy3line'),
|
||||
'copy2line' => __('email.copy2line'),
|
||||
'copy3line' => __('email.copy3line'),
|
||||
'greetings' => __('email.greetings'),
|
||||
'sender' => __('email.sender'),
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class MailVerifyContact extends Mailable
|
|||
use Queueable, SerializesModels;
|
||||
|
||||
protected $confirmation_code;
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ class MailVerifyContact extends Mailable
|
|||
{
|
||||
$salutation = __('email.salutation').",";
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation == "mr"){
|
||||
if($this->user->account->salutation === "mr"){
|
||||
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
|
||||
}else{
|
||||
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
|
||||
|
|
|
|||
70
app/Models/File.php
Normal file
70
app/Models/File.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class File
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $filename
|
||||
* @property string $dir
|
||||
* @property string $original_name
|
||||
* @property string $ext
|
||||
* @property string $mine
|
||||
* @property int $size
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @property User $user
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class File extends Model
|
||||
{
|
||||
protected $table = 'files';
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'size' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'identifier',
|
||||
'filename',
|
||||
'dir',
|
||||
'original_name',
|
||||
'ext',
|
||||
'mine',
|
||||
'size'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function formatBytes($precision = 2)
|
||||
{
|
||||
$size = $this->size;
|
||||
|
||||
if ($size > 0) {
|
||||
$size = (int) $size;
|
||||
$base = log($size) / log(1024);
|
||||
$suffixes = array(' bytes', ' KB', ' MB', ' GB', ' TB');
|
||||
|
||||
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
|
||||
} else {
|
||||
return $size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -66,19 +66,22 @@ class ShoppingPayment extends Model
|
|||
|
||||
public function getPaymentType(){
|
||||
|
||||
if($this->clearingtype == 'wlt') {
|
||||
if ($this->wallettype == 'PPE') {
|
||||
if($this->clearingtype === 'wlt') {
|
||||
if ($this->wallettype === 'PPE') {
|
||||
return 'PayPal';
|
||||
}
|
||||
}
|
||||
if($this->clearingtype == 'cc') {
|
||||
if($this->clearingtype === 'cc') {
|
||||
return 'Kreditkarte';
|
||||
}
|
||||
if($this->clearingtype == 'vor') {
|
||||
if($this->clearingtype === 'vor') {
|
||||
return 'Vorkasse';
|
||||
}
|
||||
if($this->clearingtype == 'sb') {
|
||||
if ($this->onlinebanktransfertype == 'PNT') {
|
||||
if($this->clearingtype === 'elv') {
|
||||
return 'SEPA Lastschrift';
|
||||
}
|
||||
if($this->clearingtype === 'sb') {
|
||||
if ($this->onlinebanktransfertype === 'PNT') {
|
||||
return 'Sofort Überweisung';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingZipcode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $orders
|
||||
* @property-read \App\Models\ShoppingOrder $shopping_order
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrder[] $shopping_orders
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereOrders($value)
|
||||
*/
|
||||
class ShoppingUser extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,6 +101,18 @@ use Carbon\Carbon;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereWebsite($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereZipcode($value)
|
||||
* @property string|null $m_account
|
||||
* @property string|null $m_salutation
|
||||
* @property string|null $m_first_name
|
||||
* @property string|null $m_last_name
|
||||
* @property string|null $m_notes
|
||||
* @property int|null $taxable_sales
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMFirstName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMLastName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMNotes($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMSalutation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereTaxableSales($value)
|
||||
*/
|
||||
class UserAccount extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,30 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\UserLevel
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property array|null $trans_name
|
||||
* @property float|null $margin
|
||||
* @property int|null $pos
|
||||
* @property int $active
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereMargin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserLevel extends Model
|
||||
{
|
||||
protected $table = 'user_levels';
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
|
||||
if ($this->app->environment() !== 'production') {
|
||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||
}
|
||||
|
|
|
|||
144
app/Repositories/ContractPDFRepository.php
Normal file
144
app/Repositories/ContractPDFRepository.php
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Libraries\ContractPDF;
|
||||
use App\Models\File;
|
||||
use App\User;
|
||||
use Request;
|
||||
use Response;
|
||||
use Storage;
|
||||
use Util;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ContractPDFRepository extends BaseRepository {
|
||||
|
||||
|
||||
|
||||
|
||||
protected $disk;
|
||||
protected $dir;
|
||||
protected $user_id;
|
||||
protected $identifier;
|
||||
|
||||
public function __construct(User $model){
|
||||
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function _set($name, $value){
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
|
||||
public function createContractPDF() {
|
||||
|
||||
$pdf = new ContractPDF();
|
||||
|
||||
$pdf->AddPage('P', array(210, 297));
|
||||
$pdf->SetFont('Helvetica', '', 11);
|
||||
$pdf->SetDrawColor(160, 160, 160);
|
||||
|
||||
$x1 = 16.5;
|
||||
$x2 = 109;
|
||||
$y = 70;
|
||||
$nl = 17.5;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->m_account);
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, now()->format("d.m.Y"));
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->company);
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pre = $this->model->account->pre_phone_id != "" ? $this->model->account->pre_phone->phone." " : "";
|
||||
$pdf->Write(0, $pre.$this->model->account->phone);
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->m_first_name);
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pre = $this->model->account->pre_mobil_id != "" ? $this->model->account->pre_mobil->phone." " : "";
|
||||
$pdf->Write(0, $pre.$this->model->account->mobil);
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->m_last_name);
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, $this->model->email);
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->address);
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, $this->model->account->birthday);
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->zipcode." ".$this->model->account->city);
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pre = $this->model->account->country_id ? $this->model->account->country->de." " : "";
|
||||
$pdf->Write(0, $pre);
|
||||
|
||||
if($this->model->m_sponsor){
|
||||
|
||||
$y += 48;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->user_sponsor->account->company);
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, $this->model->user_sponsor->account->m_account);
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->user_sponsor->account->m_first_name." ".$this->model->user_sponsor->account->m_last_name);
|
||||
|
||||
$website = $this->model->user_sponsor->shop()->count() ? $this->model->user_sponsor->shop->getSubdomain() : "www.mivita.care";
|
||||
|
||||
}else{
|
||||
$website = "www.mivita.care";
|
||||
}
|
||||
|
||||
$pdf->AddPage('P', array(210, 297));
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$pdf->SetDrawColor(160, 160, 160);
|
||||
$pdf->SetXY(52, 56);
|
||||
$pdf->Write(0, $website);
|
||||
|
||||
|
||||
$pdf->SetXY($x1, 65);
|
||||
$pdf->Write(0, $this->model->account->m_first_name." ".$this->model->account->m_last_name);
|
||||
$pdf->SetXY($x2, 65);
|
||||
$pdf->Write(0, $this->model->account->m_account);
|
||||
|
||||
$pdf->AddPage('P', array(210, 297));
|
||||
|
||||
|
||||
if(!Storage::disk($this->disk)->exists( $this->dir )){
|
||||
Storage::disk($this->disk)->makeDirectory($this->dir); //creates directory
|
||||
}
|
||||
$filename = "MIVITA_Beratervertrag.pdf";
|
||||
Storage::disk($this->disk)->put($this->dir.$filename, $pdf->Output('S'));
|
||||
$size = Storage::disk($this->disk)->size($this->dir.$filename);
|
||||
$mine = Storage::disk($this->disk)->getMimeType($this->dir.$filename);
|
||||
|
||||
File::create([
|
||||
'user_id' => $this->model->id,
|
||||
'identifier' => $this->identifier,
|
||||
'filename' => $filename,
|
||||
'dir' => $this->dir,
|
||||
'original_name' => $filename,
|
||||
'ext' => "pdf",
|
||||
'mine' => $mine,
|
||||
'size' => $size
|
||||
]);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
141
app/Repositories/FileRepository.php
Normal file
141
app/Repositories/FileRepository.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\File;
|
||||
use Request;
|
||||
use Response;
|
||||
use Storage;
|
||||
use Util;
|
||||
use Validator;
|
||||
|
||||
|
||||
class FileRepository extends BaseRepository {
|
||||
|
||||
|
||||
protected $rules;
|
||||
protected $messages;
|
||||
|
||||
protected $disk;
|
||||
protected $dir;
|
||||
protected $user_id;
|
||||
protected $identifier;
|
||||
|
||||
public function __construct(File $model){
|
||||
|
||||
$this->model = $model;
|
||||
|
||||
$this->rules = [
|
||||
'file' => 'required|mimes:pdf,jpeg,png|max:32768'
|
||||
];
|
||||
$this->messages = [
|
||||
'file.mimes' => 'Datei ist kein PDF Format',
|
||||
'file.required' => 'PDF-Datei wird benötigt'
|
||||
];
|
||||
}
|
||||
|
||||
public function _set($name, $value){
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
|
||||
/* public function load($id){
|
||||
$this->model = $id;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public function uploadFile( $form_data )
|
||||
{
|
||||
|
||||
$validator = Validator::make($form_data, $this->rules, $this->messages);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return Response::json([
|
||||
'error' => true,
|
||||
'message' => $validator->messages()->first(),
|
||||
'code' => 400
|
||||
], 400);
|
||||
}
|
||||
$file = $form_data['file'];
|
||||
|
||||
$originalName = $file->getClientOriginalName();
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
$mine = $file->getClientMimeType();
|
||||
$size = $file->getClientSize();
|
||||
|
||||
|
||||
$originalNameWithoutExt = substr($originalName, 0, strlen($originalName) - strlen($extension) - 1);
|
||||
$filename = Util::sanitize($originalNameWithoutExt, true, false, true);
|
||||
$allowed_filename = uniqid() . '_' . $filename.".".$extension;
|
||||
|
||||
//$dir = $this->model->getInvoiceStorageAttDir();
|
||||
|
||||
if(!Storage::disk($this->disk)->exists( $this->dir )){
|
||||
Storage::disk($this->disk)->makeDirectory($this->dir); //creates directory
|
||||
}
|
||||
Storage::disk($this->disk)->put($this->dir.$allowed_filename, file_get_contents($file->getRealPath()));
|
||||
|
||||
File::create([
|
||||
'user_id' => $this->user_id,
|
||||
'identifier' => $this->identifier,
|
||||
'filename' => $allowed_filename,
|
||||
'dir' => $this->dir,
|
||||
'original_name' => $originalName,
|
||||
'ext' => $extension,
|
||||
'mine' => $mine,
|
||||
'size' => $size
|
||||
]);
|
||||
|
||||
return Response::json([
|
||||
'error' => false,
|
||||
'filename' => $allowed_filename,
|
||||
'filedata' => 'pdf',
|
||||
'redirect' => route('wizard_register'),
|
||||
'code' => 200
|
||||
], 200);
|
||||
}
|
||||
|
||||
/* public function createFile(Request $request)
|
||||
{
|
||||
$locale = \App::getLocale();
|
||||
$data = [
|
||||
'step' => 2,
|
||||
'locale' => $locale,
|
||||
];
|
||||
$rules = array(
|
||||
'network_name' => 'required|max:255',
|
||||
'input_file_now' => 'required|mimes:png,pdf,jpg,jpeg|max:30000'
|
||||
);
|
||||
$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.register_complete', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
$user = \Auth::user();
|
||||
if(!$user->account->network_name){
|
||||
$file = request()->file('input_file_now');
|
||||
//$ext = $file->guessClientExtension();
|
||||
//$file->storeAs('user/' . $user->id .'/verification');
|
||||
$data = $file->store('user/' . $user->id .'/verification');
|
||||
$account = $user->account;
|
||||
$account->network_name = Input::get('network_name');
|
||||
$account->network_verification = basename($data);
|
||||
$account->save();
|
||||
|
||||
$user->role_id = 2; //set as User by default!
|
||||
$user->save();
|
||||
|
||||
|
||||
}
|
||||
|
||||
return redirect('complete_register');
|
||||
//return view('user.register_complete', $data);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ namespace App\Repositories;
|
|||
|
||||
use App\Models\UserAccount;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
|
||||
|
||||
class UserRepository extends BaseRepository {
|
||||
|
|
@ -15,6 +17,7 @@ class UserRepository extends BaseRepository {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public function update($data)
|
||||
{
|
||||
|
||||
|
|
@ -44,7 +47,30 @@ class UserRepository extends BaseRepository {
|
|||
$this->model->save();
|
||||
}
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function create($data){
|
||||
|
||||
$this->model = User::create([
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
|
||||
$account = UserAccount::create([
|
||||
'm_salutation' => $data['salutation'],
|
||||
'm_first_name' => $data['first_name'],
|
||||
'm_last_name' => $data['last_name'],
|
||||
'salutation' => $data['salutation'],
|
||||
'first_name' => $data['first_name'],
|
||||
'last_name' => $data['last_name'],
|
||||
]);
|
||||
|
||||
$this->model->account_id = $account->id;
|
||||
$this->model->save();
|
||||
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
public function deleteUser(User $user)
|
||||
|
|
|
|||
|
|
@ -120,5 +120,24 @@ class Util
|
|||
}
|
||||
return url($uri);
|
||||
}
|
||||
public static function sanitize($string, $force_lowercase = true, $anal = false, $substr = false)
|
||||
{
|
||||
$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]",
|
||||
"}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—",
|
||||
"—", "–", ",", "<", ".", ">", "/", "?");
|
||||
$clean = trim(str_replace($strip, "", strip_tags($string)));
|
||||
$clean = preg_replace('/\s+/', "_", $clean);
|
||||
$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ;
|
||||
|
||||
if($substr){
|
||||
$clean = (strlen($clean) > 20) ? substr($clean,-20) : $clean;
|
||||
|
||||
}
|
||||
return ($force_lowercase) ?
|
||||
(function_exists('mb_strtolower')) ?
|
||||
mb_strtolower($clean, 'UTF-8') :
|
||||
strtolower($clean) :
|
||||
$clean;
|
||||
}
|
||||
|
||||
}
|
||||
61
app/User.php
61
app/User.php
|
|
@ -80,6 +80,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePaymentAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePaymentShop($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereWizard($value)
|
||||
* @property int|null $m_level
|
||||
* @property int|null $m_sponsor
|
||||
* @property-read \App\Models\UserLevel|null $user_level
|
||||
* @property-read \App\User|null $user_sponsor
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereMLevel($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereMSponsor($value)
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
@ -110,13 +116,11 @@ class User extends Authenticatable
|
|||
];
|
||||
|
||||
|
||||
public function account()
|
||||
{
|
||||
public function account(){
|
||||
return $this->belongsTo('App\Models\UserAccount', 'account_id');
|
||||
}
|
||||
|
||||
public function user_level()
|
||||
{
|
||||
public function user_level(){
|
||||
return $this->belongsTo('App\Models\UserLevel', 'm_level');
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +129,10 @@ class User extends Authenticatable
|
|||
|
||||
}
|
||||
|
||||
public function files(){
|
||||
return $this->hasMany('App\Models\File', 'user_id', '');
|
||||
|
||||
}
|
||||
|
||||
public function shop()
|
||||
{
|
||||
|
|
@ -203,6 +210,42 @@ class User extends Authenticatable
|
|||
|
||||
|
||||
|
||||
public function isActiveAccount(){
|
||||
return $this->payment_account ? Carbon::parse($this->payment_account)->gt(Carbon::now()) : false;
|
||||
}
|
||||
|
||||
public function isActiveShop(){
|
||||
return $this->payment_shop ? Carbon::parse($this->payment_shop)->gt(Carbon::now()) : false;
|
||||
}
|
||||
|
||||
|
||||
public function daysActiveAccount(){
|
||||
return Carbon::now()->diffInDays(Carbon::parse($this->payment_account), false);
|
||||
}
|
||||
|
||||
public function modifyActiveAccount($add = "1 year"){
|
||||
return Carbon::parse($this->payment_account)->modify($add)->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function daysHumansActiveAccount(){
|
||||
Carbon::setLocale(\App::getLocale());
|
||||
return Carbon::now()->diffForHumans(Carbon::parse($this->payment_account));
|
||||
}
|
||||
|
||||
public function daysActiveShop(){
|
||||
return Carbon::now()->diffInDays(Carbon::parse($this->payment_shop), false);
|
||||
}
|
||||
|
||||
public function modifyActiveShop($add = "1 year"){
|
||||
return Carbon::parse($this->payment_shop)->modify($add)->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function daysHumansActiveShop(){
|
||||
Carbon::setLocale(\App::getLocale());
|
||||
return Carbon::now()->diffForHumans(Carbon::parse($this->payment_shop));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -244,6 +287,16 @@ class User extends Authenticatable
|
|||
return Carbon::parse($this->attributes['payment_shop'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function getReleaseAccountFormat($time = true){
|
||||
if(!$this->attributes['release_account']){ return ""; }
|
||||
if(!$time){
|
||||
return Carbon::parse($this->attributes['release_account'])->format(\Util::formatDateDB());
|
||||
}
|
||||
return Carbon::parse($this->attributes['release_account'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ if (! function_exists('make_old_url')) {
|
|||
return config('app.old_url').$path;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue