maximaexchen

Experience

14,400

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 133 Lessons Completed
  • 0 Favorites

22nd May, 2018

maximaexchen left a reply on Add Custom Subscription Plans Limitations Problem • 2 months ago

No one? :-(

18th May, 2018

maximaexchen started a new conversation Add Custom Subscription Plans Limitations Problem • 3 months ago

Hi everybody,

I posted a problem last week. But I am still stuck.

https://laracasts.com/discuss/channels/laravel/best-way-to-restict-the-amount-of-records-a-user-with-sepcific-subscription-plan-can-create

I need to have the possibility to check different subscription plans and than react on them in many controllers and views of the application. And each subscription plan has some different limitations creating amount records for different models and so on.

e.g. plan_1 an account can add/edit/view/list max 5 procedures-records and only can have one user and one client plan_2 an account can add/edit/view/list max 20 procedures-records and only can have one user and 20 clients ... plan_10 unlimited

etc.

Background info: the subscription is added to an account, which is created when a user registers. An account has on or many users and clients.

I am still learning all that stuff and I am a bit confused how to handle this kind of programming challenge. For info, unfortunately I cannot use stripe because of the european "General Data Protection Regulation - GDPR". So I have to do subscription and payment stuff on my own.

So what I tried / I thought about

If I have policy, as I understand, it can only return true or false. If I do something like this in my policy;

class ProcedurePolicy
{
    public function max_procedures_items(User $user)
    {
        $account = Account::whereId(Auth::user()->account_id)->firstOrFail();
        $account->clients()->first()->procedures()->count();
        return $account->clients()->first()->procedures()->count() >= 5;
    }
}

So I have to do this for every different user with a different subscription plan, right? Does not feel right.

I thought about accessors and mutators, but this doesen't works "globally" in different controllers and views, right?

like so

class Account extends Model
{
    public $max_procedure_items = null;

    ...

    /**
     * Set max item number.
     *
     * @param  string  $value
     * @return void
     */
    public function setMaxProcedureItemsAttribute($value)
    {
        $this->attributes['max_procedure_items'] = $value;
    }

    /**
     * Get max item number.
     *
     * @param  string  $value
     * @return void
     */
    public function getMaxProcedureItemsAttribute($value)
    {
        return $value;
    }
}

Sessions?

I am lost. I hope this describes my knowlege problem understandable. I am not that good in programming design pattern, but is there one which could fit and usable in the laravel system?

Any hints, enlightenments, links, tutorials would be great. Thanks for reading.

Regards Marcus

9th May, 2018

maximaexchen left a reply on Best Way To Restict The Amount Of Records A User With Sepcific Subscription Plan Can Create • 3 months ago

I think policy feels more logic.

@martinbean Thanks, for your advice.

maximaexchen started a new conversation Best Way To Restict The Amount Of Records A User With Sepcific Subscription Plan Can Create • 3 months ago

Hi everybody.

I have a subscription system with 4 plans. So plan1 subscribers should only be able to create 4 records of a model and so on...

I have spatie/laravel-permission in use and own subscription logic.

What would be the best way in your opinion. Roles and Permissions? Policy / Gate?

To do it directly in controller sounds not good to me. I am still learning, so any suggestion appreciated.

Thanks in advance. Regards Marcus

27th April, 2018

maximaexchen left a reply on Class Defined In Component Data Not Available In Different Methods. • 3 months ago

Nobody?

do I have to define it like so, to use a class in different methods?

...
data() {
            return {
        errorsone: new Errors(),
        errorstwo: new Errors(),
....

checkPersonalData: function () {
....
    .catch(error => {
                    this.loading = false;
                    console.log("05: " +  this.errors);
                    this.errorsone.record(error.response.data.errors) <- ?
                });
....
finalizeSubscription: function () {
...
    .catch(error => {
                    this.loading = false;
                    console.log("05: " +  this.errors);
                    this.errorstwo.record(error.response.data.errors) <- ?
                });

Or did I explain my problem not specific enough?

Thanks and regards

24th April, 2018

maximaexchen left a reply on Route Issue • 3 months ago

Hi. What does artisan route:list show?

maximaexchen left a reply on Class Defined In Component Data Not Available In Different Methods. • 3 months ago

Somehow I cannot edit my whole post. :-(

this.errors.record(error.response.data.errors) // in finalizeSubscription

Throws the error "TypeError: this.errors is undefined"

maximaexchen started a new conversation Class Defined In Component Data Not Available In Different Methods. • 3 months ago

Hi. I have follwoing code.

I defined

errors: new Errors() // in data

Like in Jeffreys tutorial.

In the first method "checkPersonalData" called everything is fine.

console.log("02: " + this.errors);  <-- 02: [object Object]

In the second method "finalizeSubscription" ok untill the call of.

this.errors.record(error.response.data.errors)


console.log("05: " + this.errors);  <-- 05: [object Object]

Here the full code.

<script>

    import { Errors, Messages } from '../Classes/PaymentMessages.js';
    import { ScalingSquaresSpinner  } from 'epic-spinners'

    var csrf_token = $('meta[name="csrf-token"]').attr('content');

    export default {
        name: 'paymentform',
        props: ['customerName','customerEmail','customerPhone'],

        data() {
            return {
                errors: new Errors(), //Custom Error Class (from laracast)
                messages: new Messages(),
                step: 1,
                subscriptionPlan: null,
                customer_name: this.customerName,
                customer_email: this.customerEmail,
                customer_phone: this.customerPhone,
                iban: null,
                tan: null,
                personaldatachecked: false,
                loading : false,
                tanReady: false
            }
        },
        components: {
            ScalingSquaresSpinner
        },
        methods: {
            prev() { this.step--; },
            next() { this.step++; },
            submit() { alert('Done.'); },
            checkPersonalData: function () {

                this.loading = true;

                console.log("00: " + this.errors);

                axios.post('/subscription/checkPersonalData', {
                    subscription_plan: this.subscriptionPlan,
                    customer_name: this.customer_name,
                    customer_email: this.customer_email,
                    customer_phone: this.customer_phone,
                    customer_iban: this.iban
                })
                .then(response => {
                    this.loading = false;
                    this.personaldatachecked = true;
                    this.tanReady = true;
                    message => this.messages.record(response.data);
                    console.log("01: " + this.errors);

                })
                .catch(error => {
                    this.loading = false;
                    console.log("02: " + this.errors);
                    this.errors.record(error.response.data.errors)
                });
            },
            finalizeSubscription: function () {

                this.loading = true;
                console.log("03: " + this.errors);

                axios.post('/subscription/finalizeSubscription', {
                    subscription_plan: this.subscriptionPlan,
                    customer_name: this.customer_name,
                    customer_email: this.customer_email,
                    customer_phone: this.customer_phone,
                    customer_iban: this.iban,
                    customer_tan: this.tan
                })
                .then(response => {
                    this.loading = false;
                    this.personaldatachecked = true;
                    this.tanReady = true;
                    message => this.messages.record(response.data);
                    console.log("04: " + this.errors);
                })
                .catch(error => {
                    this.loading = false;
                    console.log("05: " +  this.errors);
                    this.errors.record(error.response.data.errors)
                });
            }
        }
    }
</script>

Anyone a suggestion for me?

Thanks in advance

Regards Marcus

20th April, 2018

maximaexchen left a reply on Form In Blade With Vue Functionality • 3 months ago

Thank you guys very much!

With your suggestions I achieved it with a component now.

maximaexchen left a reply on Form In Blade With Vue Functionality • 3 months ago

Ok. I will try to get the things together. Maybe I come back later. ;-)

Thank you both!

maximaexchen left a reply on Form In Blade With Vue Functionality • 3 months ago

@extends('master')
@section('content')
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-8">
                <div class="card">
                    <div class="card-header">
                        {{ __('Your plan') }}
                    </div>

                    @foreach ($errors->all() as $error)
                        <p class="alert alert-danger">{{ $error }}</p>
                    @endforeach

                    <form action="subscription/create" method="post" id="payment-form">
                        <div class="card-block">

                            {!! csrf_field() !!}

                            <div v-if="step === 1">
                                <div class="row">
                                    <div class="col-sm-6 col-md-3">
                                        <div class="card">
                                            <div class="card-header">
                                                {{ __('Basic free') }}
                                            </div>
                                            <div class="card-block">
                                                <label name="plan1" class="plan">

                                                    <span class="input-control radio">
                                                        <input v-model="subscription.subscription_plan" name="subscription_plan" class="subscription_plan" value="basic"
                                                               {{ old('subscription_plan') === "basic" ? "checked" : "" }}
                                                               type="radio">
                                                        <span class="check"></span>
                                                    </span>

                                                    <label>Basic</label>

                                                    <span class="price monthPrice" style="">
                                                        <span class="currency">&euro;</span>
                                                        <span class="amount">0,00</span>
                                                    </span>
                                                </label>
                                            </div>
                                        </div>
                                    </div>


                                    <div class="col-sm-6 col-md-3">
                                        <div class="card">
                                            <div class="card-header">
                                                {{ __('DSB Basic') }}
                                            </div>
                                            <div class="card-block">
                                                <label name="dsb_basic" class="plan">

                                                    <span class="input-control radio">
                                                        <input v-model="subscription.subscription_plan" name="subscription_plan" class="subscription_plan" value="dsb_basic"
                                                               {{ old('subscription_plan') === "dsb_basic" ? "checked" : "" }}
                                                               type="radio">
                                                        <span class="check"></span>
                                                    </span>

                                                    <label>DSB Basic</label>

                                                    <span class="price monthPrice" style="">
                                                        <span class="currency">&euro;</span>
                                                        <span class="amount">9,99</span>
                                                    </span>
                                                </label>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-sm-6 col-md-3">
                                        <div class="card">
                                            <div class="card-header">
                                                {{ __('DSB PRo') }}
                                            </div>
                                            <div class="card-block">
                                                <label name="dsb_pro" class="plan">

                                                    <span class="input-control radio">
                                                        <input v-model="subscription.subscription_plan" name="subscription_plan" class="subscription_plan" value="dsb_pro"
                                                               {{ old('subscription_plan') === "dsb_pro" ? "checked" : "" }}
                                                               type="radio">
                                                        <span class="check"></span>
                                                    </span>

                                                    <label>DSB Pro</label>

                                                    <span class="price monthPrice" style="">
                                                        <span class="currency">&euro;</span>
                                                        <span class="amount">24,90</span>
                                                    </span>
                                                </label>
                                            </div>
                                        </div>

                                    </div>

                                    <div class="col-sm-6 col-md-3">
                                        <div class="card">
                                            <div class="card-header">
                                                {{ __('DSB Verein') }}
                                            </div>
                                            <div class="card-block">
                                                <label name="dsb_verein" class="plan">

                                                    <span class="input-control radio">
                                                        <input v-model="subscription.subscription_plan" name="subscription_plan" id="subscription_plan" value="dsb_verein"
                                                               {{ old('subscription_plan') === "dsb_verein" ? "checked" : "" }}
                                                               type="radio">
                                                        <span class="check"></span>
                                                    </span>

                                                    <label>DSB Verein</label>

                                                    <span class="price monthPrice" style="">
                                                        <span class="currency">&euro;</span>
                                                        <span class="amount">5,90</span>
                                                        <span class="month monthPrice"></span>
                                                    </span>
                                                </label>
                                            </div>
                                        </div>
                                        <button @click.prevent="next()">Next</button>

                                    </div>

                                </div>

                            </div>

                            <div v-if="step === 2">
                                <div class="form-group">
                                    <label for="customer_name">{{ __('Name') }}</label>
                                    <input v-model="subscription.customer_name" type="text" class="form-control" id="customer_name" name="customer_name" value="{{ $user->name ?? '' }}">

                                </div>


                                <div class="form-group">
                                    <label for="customer_email">{{ __('Email') }}</label>
                                    <input v-model="subscription.customer_email" type="text" class="form-control" id="customer_email" name="customer_email" value="{{ $user->email ?? '' }}">
                                </div>

                                <div class="form-group">
                                    <label for="customer_iban">{{ __('IBAN') }}</label>
                                    <input v-model="subscription.customer_iban" type="text" class="form-control" id="customer_iban" name="customer_iban" value="">
                                </div>

                                <div class="form-group">
                                    <label for="customer_phone">{{ __('Mobilenumber') }}</label>
                                    <input v-model="subscription.customer_phone" type="text" class="form-control" id="customer_phone" name="customer_phone" value="{{ $user->telephone ?? '' }}">
                                </div>
                                <button @click.prevent="prev()">Previous</button>
                                <button @click.prevent="next()">Next</button>
                            </div>
                            <div v-if="step === 3">
                                TAN
                                <button @click.prevent="prev()">Previous</button>
                                <button @click.prevent="submit()">Save</button>
                            </div>
                        </div>

                        <div class="card-footer">
                            <button type="submit" class="btn btn-primary" ><i class="fa fa-check-circle" aria-hidden="true"></i> {{ __('Submit Payment') }}</button>
                        </div>



                    </form>
                </div>


            </div>
        </div>
    </div>
@endsection


@section('scripts')
    <script>
        export default {
            name: 'paymentform',
            data() {
                return {
                    step:1,
                    subscription:{
                        subscription_plan:'{{ json_encode($user->name ) }}',
                        customer_name:'{{ json_encode($user->name ) }}',
                        customer_email:'{{ json_encode($user->email ) }}',
                        customer_phpne:'{{ json_encode($user->telephone ) }}',
                        customer_iban:'',
                        customer_tan:''
                    }
                }
            },
            methods:{
                prev() {
                    this.step--;
                },
                next() {
                    this.step++;
                },
                submit() {
                    alert('END');
                }
            }
        }
    </script>

@endsection

maximaexchen left a reply on Form In Blade With Vue Functionality • 3 months ago

Mhh. Ok. When I paste your code into the app.js file I get "this.user.plan" in the input field, not the value from the controller.

I think have to pass the values via

{{ json_encode($user->name ) }}

Right? But where?

Do I need to have a part with

export default {
            name: 'paymentform',
            data() {
                return {
                    step:1,
                    subscription:{
                        subscription_plan:'{{ json_encode($user->plan ) }}',
                        customer_name:'{{ json_encode($user->name ) }}',
                        customer_email:'{{ json_encode($user->email ) }}',
                        customer_phone:'{{ json_encode($user->telephone ) }}',
                        customer_iban:'',
                        customer_tan:''
                    }
                }
            }
}

in the blade script part?

Thanks for your patience.

19th April, 2018

maximaexchen left a reply on Form In Blade With Vue Functionality • 3 months ago

yes. the question is how to get the values from the form in the blade file to script in the app.js file.

eg.

$user->name

maximaexchen started a new conversation Form In Blade With Vue Functionality • 3 months ago

Hi. I have a vue instance on #app. which is used by a site wide tooltip component.

Now I try to get a subscription multistep form in a blade file up and running.

I still beginn to understand how all this is working together.

in my app.js I have

const app = new Vue({
    el: '#app',
    data: function () {
        return {
            step:1,
            subscription:{
                subscription_plan:'',
                customer_name:'',
                customer_email:'',
                customer_iban:'',
                customer_tan:''
            }
        }
    },
    methods:{
        prev() {
            this.step--;
        },
        next() {
            this.step++;
        },
        submit() {
            
        }
    }
});

in the subscription.blad.php

<div v-if="step === 2">
                                <div class="form-group">
                                    <label for="customer_name">{{ __('Name') }}</label>
                                    <input v-model="subscription.customer_name" type="text" class="form-control" id="customer_name" name="customer_name" value="{{ $user->name ?? '' }}">

                                </div>


                                <div class="form-group">
                                    <label for="customer_email">{{ __('Email') }}</label>
                                    <input v-model="subscription.customer_email" type="text" class="form-control" id="customer_email" name="customer_email" value="{{ $user->email ?? '' }}">
                                </div>

                                <div class="form-group">
                                    <label for="customer_iban">{{ __('IBAN') }}</label>
                                    <input v-model="subscription.customer_iban" type="text" class="form-control" id="customer_iban" name="customer_iban" value="">
                                </div>

                                <div class="form-group">
                                    <label for="customer_phone">{{ __('Mobilenumber') }}</label>
                                    <input v-model="subscription.customer_phone" type="text" class="form-control" id="customer_phone" name="customer_phone" value="{{ $user->telephone ?? '' }}">
                                </div>
                                <button @click.prevent="prev()">Previous</button>
                                <button @click.prevent="next()">Next</button>
                            </div>

The initial values of the input fields get emptied when the VUE instance is called.

Could some one give me a hin?

Thanks and regards Marcus

14th April, 2018

maximaexchen left a reply on Route Validation • 4 months ago

@wilk_randall Ok. So I have to add a policy for every model, right?

Isn't there a more "global" possibilty? I have about 20 models which need to be guearded.

13th April, 2018

maximaexchen left a reply on Route Validation • 4 months ago

@wilburpowery thanks for your advice.

So it seems to be reasonable to crate a "global" Policy. Any advice? If I have many routes like:

lients/{client}/servicecategories 
lients/{client}/model2 
lients/{client}/model3
lients/{client}/model4
....

maximaexchen started a new conversation Route Validation • 4 months ago

Hi everybody,

I have a security issue.

I have a route like:

clients/{client}/servicecategories 

how can I secure that a user can only call the client/servicecategories belongs to auth user. A user can have several clients.

I have a system like.

User belongsTo an Account Account hasMany Users User hasMany Clients

In the FormRequest (update/create), if I understood it correct, I could do it with a custom authorize() adjustment.

But how to prevent it in the controller-index-method?

I need a custom middleware to check if the clientId belongs to the user/account, right? But I don't know how....

Thanks in advance for any advice.

Regards Marcus

11th April, 2018

maximaexchen left a reply on Blade Testing If In_array Combined With Unserialize • 4 months ago

Ok. I found the problem.

I have overseen that I am in a loop. And I always only dumped in the first iteration.... Shame on me. Thank you anyway!

Regards Marcus

maximaexchen left a reply on Blade Testing If In_array Combined With Unserialize • 4 months ago

If I do

{{ dd(unserialize($receiver->type)) }}

it returns

array:1 [▼
  0 => "external"
]

maximaexchen left a reply on Blade Testing If In_array Combined With Unserialize • 4 months ago

receiver->type is a serialized array

 a:1:{i:0;s:8:"external";}

maximaexchen left a reply on Blade Testing If In_array Combined With Unserialize • 4 months ago

Thanks.

@rin4ik Not working

If I try it like this:

<span class="small-text">(
                                @if(in_array('internal', unserialize($receiver->type)))
                                    {{ __('internal')  }}
                                    @else
                                    {{ __('external') }}
                                @endif

                            )</span>

Same error

maximaexchen started a new conversation Blade Testing If In_array Combined With Unserialize • 4 months ago

Hey. I have a strange problem. Maybe I missed something.

In my blade I have.


@foreach($receivers as $receiver)
               @if(in_array($receiver->id, $selectedReceivers))
                    <li>
                        {!! $receiver->name !!}
                        @if(!empty($receiver->type))
                            <span class="small-text">({{ in_array(__('internal'), unserialize($receiver->type)) ? __('internal') : __('external') }})</span>
                        @endif
                    </li>
                @endif
            @endforeach

I get the error

in_array() expects parameter 2 to be array, null given

but if I test

is_array(unserialize($receiver->type)) => true

Can someone give me a hint?

Thanks and regards Marcus

3rd March, 2018

maximaexchen left a reply on Query Builder Subquery Join On Pivot • 5 months ago

I want to combine the two statements above.

I like to have one query with the procedures form the first with the related data_categories over the pivot data_category_procedure from the second.

maximaexchen started a new conversation Query Builder Subquery Join On Pivot • 5 months ago

Hi, I cannot use eloquent because of performance issues. (I think)

I have this, which ist working.

$procedures = DB::table('procedures')
            ->leftJoin('users as updateuser', 'updateuser.id', '=', 'procedures.update_user_id')
            ->leftJoin('users as createuser', 'createuser.id', '=', 'procedures.create_user_id')
            ->leftJoin('users as releaseuser', 'releaseuser.id', '=', 'procedures.release_user_id')
            ->select('procedures.*','updateuser.name as updateuser_name' , 'createuser.name as createuser_name', 'releaseuser.name  as releaseuser_name')
            ->where($addWhere)
            ->orderBy('procedures.attachment_01')
            ->get();

and now I have to insert this:

select `data_category_procedure`.*, `data_categories`.*, `procedures`.* from `data_category_procedure`
        inner join `procedures` on `data_category_procedure`.`procedure_id` = `procedures`.`id`
        inner join `data_categories` on `data_category_procedure`.`data_category_id` = `data_categories`.`id`

I need to have a value from data_categories.

Can someone please help? Thanks in advance. Regards Marcus

27th February, 2018

maximaexchen left a reply on Reusable Component With Different Content/text/values • 5 months ago

Hi.

Thanks a lot! You both! I would never think about that this was the problem. Worked like a charm.

You made my day!

maximaexchen started a new conversation Reusable Component With Different Content/text/values • 5 months ago

Hi. I am new to vue. :-( I try to add a reusable tooltip component to blade.

test.blade.php

<tooltip header="Headline 1" bodycontent="Bodycontent 1"></tooltip>
<tooltip header="Headline  2" bodycontent="Bodycontent 2"></tooltip>

Tooltip.vue

<template>
<div>

    <div id="contentpopup1" style="display: none" v-tippy-html>
        <div>
            <h3>{{ headline }}</h3>
            <p>{{ body }}</p>
        </div>
    </div>
    <button v-tippy="{ html : '#contentpopup1'  , interactive : true, reactive : false , theme : 'light' }"> INFO </button>
</div>
</template>
<script>
    export default {
        props: ['header','bodycontent'],
        data: function () {
            return {
                //bodycontent: 'btn-primary',
                headline: this.header,
                body:  this.bodycontent,
            }
        },
    }
</script>

I cannot figure out to change the 2 values for each tooltip... It always renders with the content of the first .

I think I have a basic lack of an idea how to work with components. I also tried named-slots....

I have no further idea for what I should google.

Suggestions? LInks?

Thanks in advance and kind regards. Marcus

2nd February, 2018

maximaexchen left a reply on Vue-form-wizard Change Default Title "Awesome Wizard" • 6 months ago

Is this a general lack of vue knowlege, or "vue-form-wizard" specific? I tried to google it but I cannot find out how to change the default props values form here:

http://vuejs.creative-tim.com/vue-form-wizard/#/?id=props

how can I override/update this:

props: {
  title: {
    type: String,
    default: 'Awesome Wizard'
  },
  subtitle: {
    type: String,
    default: 'Split a complicated flow in multiple steps'
  }
}

I am new to this topic. Someon who can bring light? Or show me where to switch light on. ;-)

Thanks in advance and regards.

maximaexchen left a reply on DB Transaction Try Catch Swift_TransportException • 6 months ago

Thanks a lot. Helped me a lot.

1st February, 2018

maximaexchen left a reply on DB Transaction Try Catch Swift_TransportException • 6 months ago

I did it now like this.

public function register(Request $request)
    {
        DB::transaction(function () use ($request) {
            try {
                $this->validator($request->all())->validate();
                $user = $this->create($request->all());
                UserVerification::generate($user);
                UserVerification::send($user);

                return back()->withAlert(__('Register successfully, please verify your email.'));

            } catch(Swift_TransportException $e){

                return back()->withAlert(__('There was a technical problem. Please contact the technical support'));
            }
        }, 5);
    }

But a new account is created. I think I still did not get it how to use it correctly

maximaexchen left a reply on DB Transaction Try Catch Swift_TransportException • 6 months ago

A ok. I see. Thanks.

maximaexchen left a reply on DB Transaction Try Catch Swift_TransportException • 6 months ago

Thanks for your reply. What do you mean with "you don't enjoy the benefit of automatic rollback"?

I will try to put DB::rollback() into function register().

maximaexchen started a new conversation Vue-form-wizard Change Default Title "Awesome Wizard" • 6 months ago

I want to change the title coming from vue-form-wizard.

It should be done by props. But I cannot figure out where to put the new string.

This is what I have: (new strings in formOptions, but this obvious wrong)

<script>
    import VueFormGenerator from "vue-form-generator";
    import {FormWizard, TabContent} from 'vue-form-wizard'
    import 'vue-form-wizard/dist/vue-form-wizard.min.css'

    export default {

        components: {
            "vue-form-generator": VueFormGenerator.component,
            FormWizard,
            TabContent,
        },
        data() {
            return {
                selectedplan:'',

                model:{
                    firstName:'',
                    lastName:'',
                    email:'',
                    streetName:'',
                    streetNumber:'',
                    city:'',
                    country:'',

                },
                formOptions: {
                    validationErrorClass: "has-error",
                    validationSuccessClass: "has-success",
                    validateAfterChanged: true,

                    title: 'New Title',
                    subtitle: 'New subtitle.',
                    nextButtonText: 'Weiter',
                    backButtonText: 'Zurück',
                    finishButtonText: 'Abschließen',

                },
                firstTabSchema:{
                    fields:[
                        {
                            type: "awesome",
                            label: "Awesome (custom field)",
                            model: "selectedplan"
                        },
                        {
                            type: "input",
                            inputType: "text",
                            label: "First name",
                            model: "firstName",
                            required:true,
                            validator:VueFormGenerator.validators.string,
                            styleClasses:'col-xs-6'
                        }
                    ]
                },
            }
        },
        methods: {
            onComplete: function(){
                alert('Yay. Done!');
            }
        }
    }
</script>


Someone can help me?

Thanks and regards

maximaexchen left a reply on DB Transaction Try Catch Swift_TransportException • 6 months ago

Anyone?

25th January, 2018

maximaexchen left a reply on DB Transaction Try Catch Swift_TransportException • 6 months ago

@martinbean Thanks for your answer. Oh. Its the complete code. I wanted to post shortend code.... didn't shortend it.

maximaexchen started a new conversation DB Transaction Try Catch Swift_TransportException • 6 months ago

Hi there,

I try to build a small registration process and have some handling problems.

Here my shortend code.


public function register(Request $request)
{
    try {
        $this->validator($request->all())->validate();
        $user = $this->create($request->all());
        UserVerification::generate($user);
        UserVerification::send($user);
        return back()->withAlert(__('Register successfully, please verify your email.'));

    } catch(Swift_TransportException $e){
        return back()->withAlert(__('There was a technical problem. Please contact the technical support'));
    }
}

protected function create(array $data)
{
    DB::beginTransaction();

   
    $account = Account::create([
        'name' => $accountname,
        'companyname' => $companyname,
    ]);

    $user =  User::create([
        'name' => $data['name'],
        'email' => encrypt($data['email']),
        'password' => bcrypt($data['password']),
        'account_id' => $account->id,
        'last_login' => Carbon::now()
    ]);

    $user->assignRole(['Accountadmin']);

    $client =  Client::create([
        'account_id' => $account->id,
        'company' => $companyname,
        'name' => $accountname,
        'default' => 1,
        'activated' => 1,
    ]);

   
    if(!$user || !$account || !$client) {
        DB::rollBack();
    } else {
        DB::commit();
        return $user;
    }
}

Obvious I have some logical problems. If there is a TransportException the account and user are created anyhow. Could someone give me a hint how I should catch any errors during registration process.

Thanks in advance. Regards

18th January, 2018

maximaexchen left a reply on Cashier - Multiple Payment Methods • 7 months ago

oh no. That was misleading. I dont't want to prefill. The values should come from the formfields... I am not that good in JS so I think I have the problem to get the values set from user input to the token.

Select plan C -> select payment method B -> submit -> stripe magic

maximaexchen started a new conversation Cashier - Multiple Payment Methods • 7 months ago

Hi there,

I have a default working checkout form with stripe creditcard payment possibility based on this tutorial: https://github.com/drehimself/stripe-elements-with-laravel/blob/master/resources/views/checkout.blade.php

And don't have any clue how and where to add the possibility to add multiple payment methods to that form. I need to use stripe.js and elements, right?

I cannot figure out to add something like this:

var sepadebit = stripe.createSource({
            type: 'sepa_debit',
            sepa_debit: {
                iban: 'DExxxxxxxxxxxxx',
            },
            currency: 'eur',
            owner: {
                name: 'Max Mustermann',
            },
        }).then(function(result) {
            // handle result.error or result.source
        });

And how do I fill it dynamically from input fields?

Anyone who can give me a push in a right direction?

Thanks in advance Regards

24th November, 2017

maximaexchen left a reply on Generate A Secured Url • 8 months ago

@martinbean Thanks! That looks promising.

maximaexchen left a reply on Generate A Secured Url • 8 months ago

Thanks a lot. I am not right shure if I got it. But i try to test your advices.

23rd November, 2017

maximaexchen left a reply on Generate A Secured Url • 8 months ago

Thanks for your reply! I think my description was a bit missleading. Sorry.

Simply spoken I need a way to generate limited lifetime secured url for a "guest" visitor who is unknown to the system. For someone who needs temporaryly acces to the user-data.

I hope my description makes more sense now.

22nd November, 2017

maximaexchen started a new conversation Generate A Secured Url • 8 months ago

Hello,

is there a possibility to generate a limited lifetime url to a page/content which you normally only can access if you are an authenticated and logged-in user.

For example as a authenticated user I want to grant access to my personal content without login with something like a encoded url www.mysite.com/kfhw3ak57jfhda6sk6hfp932sdfsd

Thankfull for any tip.

Regards

maximaexchen left a reply on Check BelongsToMany Before Deleting It • 8 months ago

Ok. I got it.

I added

$table->foreign('procedure_id')->references('id')->on('procedures');
$table->foreign('thirdcountry_id')->references('id')->on('thirdcountries');

in the migration. That did the trick.

maximaexchen left a reply on Check BelongsToMany Before Deleting It • 8 months ago

Ok. Thanks! I think the way to check it on database level would be the best.

but I don't get it. Is it possible to set constrains on pivot_table via migration? My migration looks like this:

Schema::create('procedure_thirdcountry', function (Blueprint $table)
{
            $table->integer('procedure_id')->unsigned();
            $table->integer('thirdcountry_id')->unsigned();
            $table->primary(['procedure_id', 'thirdcountry_id']);
});

Or do I need another way ?

maximaexchen started a new conversation Check BelongsToMany Before Deleting It • 8 months ago

Hello. I could not find a answer...

What would be the best way to prevent deleting a belongsToMany model wich is related to some other models. So I could set a warning "This model could not be deleted, because it is in unse by....."

Thanks in advance for any advice.

Regards

20th October, 2017

maximaexchen left a reply on Problem With Dusk Setup • 9 months ago

Nobdy?

Too simple? Overseen something? Have a link?

Regards

19th October, 2017

maximaexchen started a new conversation Problem With Dusk Setup • 10 months ago

Hey,

I try to setup testing with Dusk. Project is on a local mac with virtualhost testproject.dev (with Dnsmasq)

I cannot figure out how to configure the driver.

Defaults in DuskTestCase

/**
     * Prepare for Dusk test execution.
     *
     * @beforeClass
     * @return void
     */
    public static function prepare()
    {
        static::startChromeDriver();
    }

    /**
     * Create the RemoteWebDriver instance.
     *
     * @return \Facebook\WebDriver\Remote\RemoteWebDriver
     */
    protected function driver()
    {
        $options = (new ChromeOptions)->addArguments([
            '--disable-gpu',
            '--headless'
        ]);

        return RemoteWebDriver::create(
            'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(
                ChromeOptions::CAPABILITY, $options
            )
        );
    }

And the Test:

/** @test */
    public function testIsLoggedInAdmin()  {

        $user = User::where('email', '=', '[email protected]')->firstOrFail();

        Auth::login($user);

        $this->browse(function ($browser) use ($user) {
            $browser->visit('/')
                ->assertSourceHas('<nav class="nav navbar-nav ml-auto">');
        });
    }

I always get a 404-Page.

Where can I tell Dusk to browse http://testproject.dev

testproject.dev is set in .env and config/app.php

Some advices?

Thanks in advance and regards.

12th October, 2017

maximaexchen left a reply on Strange Behavior After Migration • 10 months ago

Ah ok. Makes sense. Thanks a lot for the explanation.

maximaexchen left a reply on Strange Behavior After Migration • 10 months ago

in the controller

 public function index()
    {

        $clientId = Session::get('client_id');
        $client =  Client::whereId($clientId)->firstOrFail();
        $persons = Person::where('client_id', $clientId)->get();

        return view('manager.account.clients.person.index', compact('persons'));
    }

maximaexchen started a new conversation Strange Behavior After Migration • 10 months ago

Hey there.

I made a new migration

 php artisan make:model Models/Person -mcr

Strangely a migration file with the name "2017_1011_121554_createpeoples_table.php" was created. Model and controller had the correct term Person. Now if a call a view in wich the person Model is called I get the error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'belabimba.people' doesn't exist (SQL: select * from `people` where `client_id` = 3)

I could not figure out why still table people is addressed. When I put

protected $table = 'persons';

to the model everything is fine. I try to understand what is going on. Is person somehow reserved? Is it cached somewhere I could not find? I also renamed the migration file manually to persons and did a migration:refresh. No effect. Any advice where to look.

Regards and thanks advance Marcus

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.