aurawindsurfing

Experience

28,690

13 Best Reply Awards

  • Member Since 1 Year Ago
  • 179 Lessons Completed
  • 5 Favorites

18th January, 2018

aurawindsurfing left a reply on URL's For Controller Actions - Where To Put It? • 3 hours ago

Ok perfect thank you!

17th January, 2018

aurawindsurfing left a reply on URL's For Controller Actions - Where To Put It? • 1 day ago

So just throw in a parameter into the route and ignore it in processing?

I would preffer to use Model id's instead of using slug's to identify my models. My app is multilingual and so slugs need to be translated as well.

aurawindsurfing left a reply on URL's For Controller Actions - Where To Put It? • 1 day ago

Snapey! You are trully a snap responder!

Ok but how do I add this to my routes so it displays for SEO purposes on each article? I do not get this.

aurawindsurfing left a reply on Best Approach To Group Orders To Each Invoice • 1 day ago

Hi,

You need to declare relationship on your models:

Here you will find the info: https://laravel.com/docs/5.5/eloquent-relationships#one-to-many-inverse

So you need to declare:

  1. Invoice has many orders, Invoice belongs to user
  2. Order belongs to Invoice, Order belongs to user
  3. Users has many Orders or User has many invoices

And then all you do is call:

$user = User::find($id)

$invoices = $user->invoices;

foreach ($invoices ad $invoice) {

$orders = $invoice->orders

}

Hope it helps!

aurawindsurfing started a new conversation URL's For Controller Actions - Where To Put It? • 1 day ago

Hi,

It must be to late or something.... So I have found this: https://laravel.com/docs/5.5/urls#urls-for-controller-actions

In relation to adding slugs to my routes like described in here:

https://sebastiandedeyne.com/posts/2017/non-breaking-seo-friendly-urls-in-laravel

but I have no idea where do I actually put this:

When generating a url, we do care about the slug though:


action('[email protected]', [$article->id, str_slug($article->title)]);

Thanks!

12th January, 2018

aurawindsurfing left a reply on Multiple Mail Drivers Laravel 5.5 • 5 days ago

I never did it but this is what your are looking for:

https://laravel.com/docs/5.5/notifications#custom-channels

9th January, 2018

aurawindsurfing left a reply on DRY In Php? • 1 week ago

Imagine what you can do with coffee!

Cheers will refactor and give it a shot!

aurawindsurfing left a reply on DRY In Php? • 1 week ago

Ok so what tou say is to create a Trait with all the junk small functions that I need and then to import that to my controllers.

But is there a way for even like code snippets? Lets say I search a model in few places in my code and the only difference is that sometimes search results are paginated some are a take(20) and some are get() but the proceedeing params are always the same.

Can I DRY this somehow?

I understand Trait and function gut I can not really chain those to have different end params.

If I create a function at the model I think the same problem will arise?

Cheers

8th January, 2018

aurawindsurfing started a new conversation DRY In Php? • 1 week ago

I remember when I was learning ruby there was a DRY rule used everywhere (Do not Repeat Yourself).

Are traits in php the only similat thing or is there some other way thal will allow me reuse pieces of my code. I mean not even a function but a piece of a funtion maybe?

Cheers!

aurawindsurfing left a reply on How To Search With FULL TEXT INDEX In Laravel 5.5 • 1 week ago

Well you can modify what you send over to algolia, actually you have to do that for search to work better on dates for instance you do it in your model like so:

public function toSearchableArray()
    {
        $array = $this->toArray();

        // change date to bool, otherwise algolia will not allow us to filter those records out

        if (array_has($array, 'deleted_at')) {
            $array['deleted_at'] = $array['deleted_at'] == null ? 0 : 1;
        } else {
            array_set($array, 'deleted_at', 0);
        }

        if (array_has($array, 'order_by')) {
            $array['order_by'] = strtotime($array['order_by']);
        }

        unset(
            $array['email'],
            $array['agree']
        );

        return $array;
    }

7th January, 2018

aurawindsurfing left a reply on How To Search With FULL TEXT INDEX In Laravel 5.5 • 1 week ago

No. Have read here:

Introduction

Laravel Scout provides a simple, driver based solution for adding full-text search to your Eloquent models. Using model observers, Scout will automatically keep your search indexes in sync with your Eloquent records.

Currently, Scout ships with an Algolia driver; however, writing custom drivers is simple and you are free to extend Scout with your own search implementations.

6th January, 2018

aurawindsurfing left a reply on Intended Not Working! • 1 week ago

As far as I know this is not part of the session by default, you need to put it there first:

Session::put('url.intended', \request()->url());

aurawindsurfing left a reply on Auth Remember System Not Working As Expected • 1 week ago

in config/session.php

/*
    |--------------------------------------------------------------------------
    | Session Lifetime
    |--------------------------------------------------------------------------
    |
    | Here you may specify the number of minutes that you wish the session
    | to be allowed to remain idle before it expires. If you want them
    | to immediately expire on the browser closing, set that option.
    |
    */

    'lifetime' => 120,

    'expire_on_close' => false,

I think this is self explanatory ;-)

aurawindsurfing left a reply on How To Search With FULL TEXT INDEX In Laravel 5.5 • 1 week ago

The easiest would be to implement something like Algolia https://www.algolia.com/pricing but is seems like your price will go through the roof with that amount of data.

Other then that would be to implement it on your end using. This packege looks promising: https://github.com/jarektkaczyk/eloquence

aurawindsurfing left a reply on Connection To Controller Isn't Working • 1 week ago

You are probably missing csrf token:

{!! csrf_field() !!}

have a look here:

https://laravel.com/docs/5.1/helpers#method-csrf-field

aurawindsurfing left a reply on Updating Pivot Table • 1 week ago

Hey!

Just had the same issue and it turned out to be a simple one.

I was trying to select and update property of a record that was deleted. So in other words you are probably not allowed to access something due to deleting it. Remove deleted_at or try ->withTrashed() and see it it helps!

Cheers

3rd January, 2018

aurawindsurfing started a new conversation Good Third Party Invoicing Integration • 2 weeks ago

Hi,

I'm looking for something tested and recommended in terms of an external invoicing integration. What I need to do is to trigger creation of new invoice and sending the same to the client on successful payment via stripe.

I'm aware that stripe has receipts build in but I need to have something that will build up nicely over time and will be also good creating reports and stuff. I use personally https://books.zoho.com/ but they do not have any wrappers for their API so being lazy I thought no harm to ask for something that already exists.

Thanks a lot!

31st December, 2017

aurawindsurfing left a reply on Hints For First Time Users Plugin? • 2 weeks ago

Hi @willvincent do you mind sharing your implementation. I have an issue trying to get it to work. Not sure if I only need joyride.js joyride.css and jquery or also something else?

22nd December, 2017

aurawindsurfing left a reply on Algolia On Developement Env Not Working • 3 weeks ago

Anyone?

21st December, 2017

aurawindsurfing started a new conversation Algolia On Developement Env Not Working • 4 weeks ago

Can anyone think of a reason for algolia PHP client (algolia/algoliasearch-client-php) not working on my local docker and working perfectly in production environment please?

$orders = \App\Order::search('foobar')->get();
dd($orders);

At first, I thought it had to be an async request, but since it works on a production I' bit confused while it shows me an empty set as a result?

aurawindsurfing left a reply on Stripe Docs On Laravel.com • 4 weeks ago

@martinbean did not think about it that way! Will give it a shot next time then!

19th December, 2017

aurawindsurfing started a new conversation Scheduled Clousure Or Scheduled Job • 4 weeks ago

Hi,

Im about to create my first scheduler and Im wondering what is the common practice in the community?

Do you tend to just create clousures in the scheduler or maybe reference a jobs or maybe some another way please?

I want to run the same thing as usually we do with cron, or is it always a mix of all of the above that you end up with?

Cheers!

15th December, 2017

aurawindsurfing left a reply on Envoyer + Vessel • 1 month ago

Well I understood it was a docker machine so therefore I thought it could be used in any env.

14th December, 2017

aurawindsurfing left a reply on Install Ivory-Google-Map Package In Laravel 5.3 ? • 1 month ago

Did you fix it or was it fixed, please?

12th December, 2017

aurawindsurfing left a reply on Add Existing Digital Ocean To Forge • 1 month ago

Depending on the size of the databases ;-)

Thanks for the answer!

aurawindsurfing left a reply on Stripe Docs On Laravel.com • 1 month ago

@martinbean I did not even touch Cashier due to this description:

If you would like to make a "one off" charge against a subscribed customer's credit card

So my understanding was that first I would have to create some subscription for that customer and only the do a once-off which in my eyes was different to simply create a customer and adding a card to his token.

But I'm probably wrong here.

10th December, 2017

aurawindsurfing left a reply on Average Of GroupBy • 1 month ago

I think you should first work out avg and then group by and then get

aurawindsurfing started a new conversation Add Existing Digital Ocean To Forge • 1 month ago

Whow do you add an existing digital ocean server to forge? Let's say I have a DB server that I created some time ago and do not want to spin a new one just for sake of it.

Is there an easy way to do this, please?

aurawindsurfing left a reply on Pagination With Dinamic Data. • 1 month ago

Your code looks too complicated to me. Why are you creating paginator instance? I would just put a paginator in the controller where I call the model and before I send it to the view like so:

$products = Product::Select('*')
        ->if($filter, 'type', '=', $filter)
        ->where('amount', '>', 0)
        ->orderBy('amount', 'DESC')
        ->withSomethingElse()
        ->simplePaginate($this->items_per_page);

return view('products', compact('products));

and nothing else.

You do not have to handle all paginator stuff since it is done automatically by Laravel.

Hope I got the question right.

9th December, 2017

aurawindsurfing left a reply on Redirect To Previous Page Exclude Login Page • 1 month ago

  1. You could use the session to store info where the user came from and check on successful registration if not to direct that user to check out.

That might be also a good idea if the user messes something up and loses his Cart info.

  1. Another better idea would be to store checkouts in a database and if the user has an unfinished checkout, then after registration redirect him to check out.

Again there are many ways to achieve the same thing. There is not right and wrong here.

aurawindsurfing left a reply on Valet And Laravel 5.5 Access Denied For User 'root'@'localhost' • 1 month ago

Try:

DB_HOST=localhost

aurawindsurfing left a reply on Access A Controller Method • 1 month ago

  1. Create a model and check on DB if a question exists?
  2. Use VueJS and ajax request to dynamically reload the content of the page.

aurawindsurfing left a reply on Pagination With Dinamic Data. • 1 month ago

Can you show your code, please?

aurawindsurfing left a reply on Stripe Docs On Laravel.com • 1 month ago

Hi,

I know exactly what you are saying. I hate to say that but I did the same mistake and did not read the documentation.

TL;TR Cashier is only for subscriptions, use Stripe SDK instead.

Introduction Laravel Cashier provides an expressive, fluent interface to Stripe's and Braintree's subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading writing. In addition to basic subscription management, Cashier can handle coupons, swapping subscription, subscription "quantities", cancellation grace periods, and even generate invoice PDFs.

If you're only performing "one-off" charges and do not offer subscriptions, you should not use Cashier. Instead, use the Stripe and Braintree SDKs directly.

Hope it helps!

aurawindsurfing left a reply on New Features Walkthrough • 1 month ago

Just to close this question: https://www.designernews.co/stories/15273-a-list-of-product-tour-plugins-for-onboarding

This is a pretty comprehensive list of what I was looking for.

aurawindsurfing started a new conversation Envoyer + Vessel • 1 month ago

Hi,

Does anyone have any experience with using Vessel with Envoyer, please? I tried to lunch it but it seems like there are issues with Vessel being a container environment. It does not play well with Envoyer.

5th December, 2017

aurawindsurfing left a reply on Event Will Not Broadcast To Pusher With BroadcastOn • 1 month ago

Hi did you figure it out please?

aurawindsurfing left a reply on Pusher • 1 month ago

"Class 'Pusher' not found in web.php (line 31)".

Look at the top of your Class, did you do this?

use Pusher;

aurawindsurfing left a reply on Assign Value In Cycle In Foreach [blade] • 1 month ago

Declare that as a table in the controller and pass it then to the view.

Then use: @foreach . . . @endforeach

aurawindsurfing left a reply on HTTP Request To API • 1 month ago

Use tool called Postman for this type of issues. I simply pasted your URL and got all the params simply extracted so I can play with it now until I get a proper response. Have a look:

aurawindsurfing left a reply on Invalid Token Errors When Trying To Tweet • 1 month ago

Looks to me like your twitter registered application might have not sufficient privileges, did not play with twitter but when works for you and does not work for another user that might indicate that there is an issue with auth itself IMHO.

aurawindsurfing started a new conversation New Features Walkthrough • 1 month ago

Hi,

I'm looking for an easy solution to implement modal to cover the web app and show user new features with that sort of scribble/box effects. Does anyone know a good resource for that, please?

29th October, 2017

aurawindsurfing left a reply on Use Vuejs In Blade Template To Conditionnally Show Block • 2 months ago

Hi,

Sorry for late replay. What you can do is keep the parts of the html in your blade and parts of it in a component like so:

Vue.component('vue-google-autocomplete', {

    template: `
    <input
        ref="autocomplete"
        name="locality"
        type="text"
        required="required"
        :class="classname"
        :id="id"
        v-model="autocompleteText"
        @focus="onFocus()"
        @blur="onBlur()"
        @change="onChange"
        @keypress.enter.prevent="onKeyPress"
     >
`,

     props: {
         id: {
             type: String,
             default: 'locality'
         },

        classname: {
             type: String,
             default: 'form-control'
        },

        types: {
            type: String,
            default: 'geocode'
        },

        country: {
            type: Array,
            default: function () { return ['ie', 'uk'] }
        },

        enableGeolocation: {
            type: Boolean,
            default: true
        }
    },
<div class="form-group">
                    <label for="locality">@lang('Location')</label>
                    <vue-google-autocomplete placeholder="{{__('Start typing name or postal code...')}}" value="{{(isset($classified)) ? $classified->locality : ''}}"></vue-google-autocomplete>
                    <input type="hidden" name="latitude" class="form-control" value="{{(isset($classified)) ? $classified->_geoloc['lat'] : ''}}" v-model="latitude" required="required">
                    <input type="hidden" name="longitude" class="form-control" value="{{(isset($classified)) ? $classified->_geoloc['lng'] : ''}}" v-model="longitude" required="required">
                </div>

So you can mix it or have everything in VueJS it is up to you.

aurawindsurfing left a reply on Session Attributes Safety • 2 months ago

Ok but once the expire the server will generate a new session and therefore overwrite the values. I understand that mistake will be to keep something super secret in session since it can be accessed while session expires... is that correct @Snapey ?

aurawindsurfing left a reply on JSON Based Language File Not Working • 2 months ago

Hi,

For anyone looking for the same thing. One comma missing at the end of any of the lines will not throw any errors, simply lang.json will not work. Double check all of the lines.

Hope it helps someone!

24th October, 2017

aurawindsurfing left a reply on Use Vuejs In Blade Template To Conditionnally Show Block • 2 months ago

Hi,

Do not think that way. You will use both jQuery and VueJs, just use whatever makes sense and is easier in that particular scenario.

I found it easier to use a mix of Laravel Collective field forms and just a regular forms when I use VueJS in that field. Laravel collective can make it look a but complicated with v-models and stuff.

Simply declare default values on data and use v-model on the input fields.

aurawindsurfing left a reply on Admin Delete This • 2 months ago

It should give you an error but check what version of app.js you are using in your browser. You probably use minified version of it created automatically by laravel webpack if you use 5.5

My bet would be that it did not update in your files.

The other thing is - do not put it in app.js put it at the top of each ajax request like so:

            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            $.ajax({
                type: "DELETE",
                url: '/user/' + id,
                success: function(result) {
                    location.reload();
                }
            });

                    

aurawindsurfing left a reply on Auth::user() Returns Null In Middleware • 2 months ago

No worries!

aurawindsurfing started a new conversation Session Attributes Safety • 2 months ago

Hi,

It is probably an easy one but I guess no harm asking:

When I store some variables in a session, how easy it is for a user to amend them? For instance if I store an expiry date and need it 2 steps down the road, how easy it will be for a user to chack it and extend the expiry date of his subscription?

Edit Your Profile
Update

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