aurawindsurfing

Hire Me

Experience

71,770

37 Best Reply Awards

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

21st September, 2018

aurawindsurfing left a reply on Email Send Fail On Some Adresses • 1 hour ago

It is probably your smtp server and not the message.

Look at its logs if you have access to them.

If it is not your server then change the server ;-)

Mailgun comes out of the box with laravel.

20th September, 2018

aurawindsurfing left a reply on Auth.password Class Is Not Found • 1 day ago

Hi,

Why you are still on 5.1? If you are trying to figure out how to reset passwords for the users you are probably only starting with your app so why 5.1?

It looks like you are missing:

use Auth\PasswordController;

at the top of your controller.

Hope it helps!

aurawindsurfing left a reply on Locations Database. Cities, Countries, Regions • 1 day ago

https://datahub.io/core/world-cities

https://github.com/KieranP/Countries-and-Cities-Database

https://github.com/hiiamrohit/Countries-States-Cities-database

You get the idea.

As for your second question, simple query scope or even eloquent should do the trick.

Hope it helps!

aurawindsurfing left a reply on How To Always Apply A Default Nova Filter When Open A Resource? • 1 day ago

Hi,

Does not look like they support it for now.

Maybe try to overwrite its underlying method that displays the array of filters. That should do the trick:

https://nova.laravel.com/docs/1.0/filters/registering-filters.html

/**
 * Get the filters available for the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function filters(Request $request)
{
    return [
        new Filters\UserType,
    ];
}

18th September, 2018

aurawindsurfing left a reply on Composer • 2 days ago

@sorbet this is not really nice and polite.

You joined 1 hour ago and start from ranting other users?

Maybe you have a bad day but that is not our fault.

Be cool.

aurawindsurfing left a reply on Composer • 2 days ago

composer.json - what composer will install composer.lock - what composer installed before and what were the top versions of it.

So in other words in absence of composer.lock composer will tray to install the newest stuff. If however composer.lock exists it locks dependencies to a certain version so you can be sure nothing will break.

That is my understanding of it. Maybe not 100% correct but works for me ;-)

Hope it helps!

17th September, 2018

aurawindsurfing left a reply on How To Allow Admin User To Simulate Or Authenticate As Any Other User On My Site? • 3 days ago

Hi,

You can do a set of routes that only admin can access to display a given user settings and edit them. You do not have to log in as that user.

Hope it helps!

aurawindsurfing left a reply on Prevent Login Before Email Verification • 3 days ago

Hi,

I think that you found some info online and you are trying to implement it. If you read carefully you will see that 5.7 implements the whole process and not only sending emails.

If you:

  1. Amend your database tables: https://laravel.com/docs/master/verification#verification-database
  2. Add routes: https://laravel.com/docs/master/verification#verification-routing

Then you will be able to use middleware to protect access like so:

Route::get('profile', function () {
    // Only verified users may enter...
})->middleware('verified');

It is all as usual really well documented here: https://laravel.com/docs/master/verification#introduction

Now just in case, you did all of that and it still does not work, try to look at your routes file. The order of routes matters and it might be the case that your logout route is being hit first before anything else and that causes the log out to occur.

Hope it helps!

aurawindsurfing left a reply on How To Publish VerifyEmail.php In Laravel 5.7 • 3 days ago

Hi,

https://laravel.com/docs/master/verification#verification-views

Laravel will generate all of the necessary email verification view when the make:auth command is executed. This views is placed in resources/views/auth/verify.blade.php. You are free to customize this view as needed for your application.

Hope it helps!

aurawindsurfing left a reply on Envoyer + Vessel • 3 days ago

Sorry forgot ;-)

aurawindsurfing left a reply on Best Practices For Routes/controllers For Index Method • 3 days ago

Hi,

I can't because I using route model binding, so I have to put the models id, but dont worry, I check if the user have permission to see each machine with middleware.

Yes you can and you actually should as this will further protect your site. There is not difference in searching a model by id and my slug or any other field for that matter.

It is also a good practice to do so. Have a look at this package: https://github.com/cviebrock/eloquent-sluggable

As for your routes

/transactions/{machine?} - [email protected]
/users/{machine?} - [email protected]

/collections/{machine} - [email protected]

Yes this will be even much cleaner as you can see. I'm not sure what is the correct expressions for that but routes should be kept simple and without too much nested levels.

Hope it helps!

aurawindsurfing left a reply on Best Practices For Routes/controllers For Index Method • 4 days ago

Hi,

From what I understand it is entirely up to you how you do it, however the less nested routes the better for readability. For instance, this makes sense:

"/transactions - [email protected]"

This a bit less:

"/machines/{machine}/users" - [email protected] ".

as you could do the reverse:

"/users/{machine}" - [email protected] ".

On those parameters try to use slugs instead of numbers for machine id:

/machines/{machine}/collections - [email protected]".

And similar to the above:

/collections/{machine} - [email protected]".

and so on

Hope it helps!

aurawindsurfing left a reply on How To Pass Array Data Instead Of Model Object To Resource Collection Class? • 4 days ago

Hi,

You are mixing up things here. There is no such thing as far as I know as: ::collection

Model Object is already a collection (I think) and you can use all collection methods on it.

To create a collection from an array you should do:

$userArr = collect($userArr)->first();

Here is more about that: https://laravel.com/docs/master/collections#method-first

Hope it helps!

aurawindsurfing left a reply on Haproxy - Ssl • 4 days ago

Hmm,

There should be no need for any extra middleware, the package https://github.com/fideloper/TrustedProxy should handle everything without any issues.

Are you seeing the cert in a browser or no cert?

Are you sure you are not on mixed content? Chrome will mark those as https but not green.

What if any hosting are you using?

Thanks!

14th September, 2018

aurawindsurfing left a reply on Need Suggestion For Authentication Table For My Application • 1 week ago

Hi,

Well the answer is it is really up to you. Just think about it.

You need to verify Employer/User to access certain resource - jobPost, admin panel, CV etc - so you need policy for that.

The policy takes the current authenticated user and does a check against something that you provide, if it is false it will redirect back, if it is true it will let User/Employer to access certain resource/page. It is completely up to you how you do it.

Having user id on a table is just a convenient way of doing it.

Hope it helps!

aurawindsurfing left a reply on Has Anyone Mix Bootstrap With Vuetify? • 1 week ago

I see, however, I would strongly recommend looking at dropping all of that stuff ;-)

Try Laravel Nova Try Tailwind

Make your life easier ;-)

aurawindsurfing left a reply on Best Shopping Cart Plugin For Laravel 5.7 • 1 week ago

Just use 5.6 for the moment ;-)

13th September, 2018

aurawindsurfing left a reply on Uploading File From IPhone's Camera To Laravel • 1 week ago

The first thing to look at would be php.ini 'upload_max_size' and 'post_max_size'.

'upload_max_size' by default is set to 2M and you picture might be bigger then that.

Hope it helps!

aurawindsurfing left a reply on Raw Expressions Localization • 1 week ago

Ok but is your question:

  1. How to store translations on database

or

  1. How to put translations in javascript?

aurawindsurfing left a reply on Raw Expressions Localization • 1 week ago

Whats it the question? How to support localization in DB?

You can store json on a DB instead of a single value, this spatie package does it quite nicely:

https://github.com/spatie/laravel-translatable

Hope it helps!

aurawindsurfing left a reply on Error When Using Php Artisan Migrate In Laravel 5.7 In Ubuntu Docker C • 1 week ago

Are you sure credentials are correct for new docker instance:

mysql:host=127.0.0.1;port=3306;dbname=course_discovery", "root", "", []

Can you connect to DB from outside? Using this ip:

docker-machine ip default

I also had once problem in JetBrains as they did not update to the newest MySQL driver and needed to downgrade to connect.

Maybe it is one of those?

Hope it helps!

aurawindsurfing left a reply on Best Shopping Cart Plugin For Laravel 5.7 • 1 week ago

It does not support 5.7

aurawindsurfing left a reply on Pusher Payload Limit • 1 week ago

Hi,

Why do that? Pusher is for notifications and not data transfers. Just send a link to the resource in payload and retrieve it after receiving the notification.

Hope it helps!

aurawindsurfing left a reply on Has Anyone Mix Bootstrap With Vuetify? • 1 week ago

Why?

aurawindsurfing left a reply on Quotation Becomes A Job - Should I Mange With A Status Column? • 1 week ago

Quotations are quotations and Jobs are Jobs.

Jobs might have additional fields later on.

Keep it separate.

aurawindsurfing left a reply on Need Suggestion For Authentication Table For My Application • 1 week ago

You can do this with Policies: https://laravel.com/docs/master/authorization#creating-policies

All you need to do it to check if someone has permissions to perform given action:

     /**
     * Determine whether the user can create jobPost.
     *
     * @param  \App\User  $user
     * @return mixed
     */
    public function create(User $user)
    {
        return $user === Auth::user();
    }

    /**
     * Determine whether the user can update the jobPost.
     *
     * @param  \App\User  $user
     * @param  \App\jobPost  $jobPost
     * @return mixed
     */
    public function update(User $user, jobPost $jobPost)
    {
        return $user->id === $jobPost->user_id;
    }

    /**
     * Determine whether the user can edit the jobPost.
     *
     * @param  \App\User  $user
     * @param  \App\jobPost  $jobPost
     * @return mixed
     */
    public function edit(User $user, jobPost $jobPost)
    {
        return $user->id === $jobPost->user_id;
    }

Hope it helps!

aurawindsurfing left a reply on Laravel Query To Laravel Eloquent • 1 week ago

Hi,

Class names do not correspond to each other:

AuthLevel::class is not class Level extends Model TravelApp::class is not class Application extends Model

They must be the same.

Your tables could look a bit different if I'm getting it right:

1. users
-id
-name
-email
-title

2. applications
-id
-user_id
-level_id
-details
-status

3. levels
-id
-name

You also might try to use pivot table in this case: https://laraveldaily.com/pivot-tables-and-many-to-many-relationships/

Hope it helps!

aurawindsurfing left a reply on Redirect Back With Ajax • 1 week ago

@petritr both approaches will work, it depends on your application flow.

aurawindsurfing left a reply on In The Case Of Send SMS Php Artisan Vendor:publish Command Is Not Working • 1 week ago

Hi,

You need to read the documentation, slowly and without skipping, this will answer most of your questions:

Then update config/nexmo.php with your credentials.

It is in the link you gave as a reference: https://github.com/Nexmo/nexmo-laravel

Good luck!

12th September, 2018

aurawindsurfing left a reply on Gate::allows() Function Not Working In API Routes • 1 week ago

Maybe you are trying to resolve a model with implicit model binding:

https://mattstauffer.com/blog/implicit-model-binding-in-laravel-5-2/

I think gates are working based on an existing model, maybe that is where it fails?

Hope it helps!

aurawindsurfing left a reply on In The Case Of Send SMS Php Artisan Vendor:publish Command Is Not Working • 1 week ago

Hi,

php artisan vendor:publish will take a config file from all of the installed vendor packages or will ask you which one you like if you on the newer laravel version, and will publish (copy) them to your config directory in your application.

You can then edit them in there. This is the way to overwrite the default setting a package might have defined by its creator or no settings for example.

Hope it helps!

aurawindsurfing left a reply on About Learnig Vue • 1 week ago

You will be fine,

Just go through that step by step: https://laracasts.com/series/learn-vue-2-step-by-step/episodes/1

Hope it helps!

11th September, 2018

aurawindsurfing left a reply on Persist State (calendar) Across Multiple Machines • 1 week ago

Turns out I was wrong and right at the same time. What I was looking for is Broadcasting which is included in Laravel of course!

https://laravel.com/docs/5.7/broadcasting

?

10th September, 2018

aurawindsurfing left a reply on Persist State (calendar) Across Multiple Machines • 1 week ago

So do you think this will be the most efficient way? I assume that doing the same with let's say pusher is not the correct practice?

aurawindsurfing left a reply on Redirect Back With Ajax • 1 week ago

This is not ajax, this is laravel.

Show us the whole controller code.

AJAX will look something like that in your view:

<script>
                        $("#createChargeButton").click(function(e) {
                            e.preventDefault();

                            $.ajaxSetup({
                                headers: {
                                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                                }
                            });
                            $.ajax({
                                type: "POST",
                                url: "/charge",
                                data: { },
                                success: function(response) {
                                    window.location.href = "/paymentsuccess";
                                },
                                error: function(response) {
                                    location.reload();
                                }
                            });
                        });
                    </script>

and here is the redirect:

window.location.href = "/paymentsuccess";

Hope it helps!

9th September, 2018

aurawindsurfing left a reply on Fetch Data From Different Categories • 1 week ago

Not necessary, but I would do that. Unless they can mix back and forth, I imagine that they do not however and you have key categories and then subcategories. Unless you call the subcategories tags and add multiple tags to a movie. Or even keep everything just with tags??? So one movie can have multiple tags and that is it and then you sort by that?

It really depends on your project tough.

Hope it helps!

aurawindsurfing left a reply on Persist State (calendar) Across Multiple Machines • 1 week ago

Is this something I could use web sockets for please?

aurawindsurfing left a reply on Fetch Data From Different Categories • 1 week ago

Hi,

Your structure could look like this:

(App\Video)->hasMany(App\Category)
(App\Category)->hasMany(App\SubCategory)
(App\SubCategory)->hasMany(App\SubSubCategory)

etc

Then you can also define reverce on Categories with belongTo(App\Video) and so on.

This way you will be able to query top->bottom and bottom->top.

Hope it helps!

aurawindsurfing left a reply on Change Api Route To Subdomain • 1 week ago

app/Providers/RouteServiceProvider

/**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::group([
            'middleware' => 'api',
            'namespace' => $this->namespace,
            'prefix' => 'api',
        ], function ($router) {
            require base_path('routes/api.php');
        });
    }

Here you can do your changes.

Hope it helps!

aurawindsurfing left a reply on Right Nginx Conf • 1 week ago

From one of my forge sites:

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/tomaszlotocki.com/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name xxx.com;
    root /home/forge/xxx.com/public;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/xxx.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}


Hope it helps!

5th September, 2018

aurawindsurfing left a reply on When Changing Connection And Table Name In Model , It Gives Error During Save() Method • 2 weeks ago

Ok I think I know where your issue is. You probably changed you config/database but you still reffer to the wrong variables in your .env file so it should look like this:

'mysql1' => [
        'driver' => 'mysql',
        'host' => env('DB1_HOST', '127.0.0.1'),
        'port' => env('DB1_PORT', '3306'),
        'database' => env('DB1_DATABASE', 'forge'),
        'username' => env('DB1_USERNAME', 'forge'),
        'password' => env('DB1_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],

'mysql2' => [
        'driver' => 'mysql',
        'host' => env('DB2_HOST', '127.0.0.1'),
        'port' => env('DB2_PORT', '3306'),
        'database' => env('DB2_DATABASE', 'forge'),
        'username' => env('DB2_USERNAME', 'forge'),
        'password' => env('DB2_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],

and then in your .env like that:

DB1_CONNECTION=mysql1 // this is not needed
DB1_HOST=
DB1_PORT=3306
DB1_DATABASE=
DB1_USERNAME=
DB1_PASSWORD=

DB2_CONNECTION=mysql2 // this is not needed
DB2_HOST=
DB2_PORT=3306
DB2_DATABASE=
DB2_USERNAME=
DB2_PASSWORD=

Now the connection will work on your model and there is no need to modify anything else.

Hope it helps!

4th September, 2018

aurawindsurfing left a reply on Scout + Algolia: Disable Typo Tolerance • 2 weeks ago

Try doing it like this:

$params = [
            'aroundLatLngViaIP' => $detectLocationByIP
        ];

$query = model::search($request->query_string)
            ->aroundLatLng($request->latitude, $request->longitude)
            ->where('deleted_at', 0);

$results = $query->with($params)->get();

I was playing with it until I got it to work. You can check in algolia dashboard what is coming in as a query and verify if you are actually sending additional params in.

Hope it helps!

aurawindsurfing left a reply on Problems With Memory Using Composer • 2 weeks ago

Hi,

I know it is a bit late but given that swapfile is potentially destroying your SSD (even though it seems like Apple in new MacBooks Pro does it all the time) it seems like the easiest solution is to resize your droplet and give yourself a bit more memory to work with.

Hope it helps!

aurawindsurfing left a reply on JSON Decode Help • 2 weeks ago

Hi Look above I updated my answer

aurawindsurfing left a reply on JSON Decode Help • 2 weeks ago

Did you try to

json_decode($json)

before dealing with this data?

aurawindsurfing left a reply on When Changing Connection And Table Name In Model , It Gives Error During Save() Method • 2 weeks ago

But you do not need to do that:

Config::set('database.default', 'mysql1');

It is enought to set database connection on model and that is it.

Why modify save() method?

aurawindsurfing left a reply on JSON Decode Help • 2 weeks ago

Hi,

$json['resource']['state']

This is how you access arrays.

Hope it helps!

Edit Your Profile
Update

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