aurawindsurfing

Problem Solver at One Day I Will Figure This Out

Experience

36,640

19 Best Reply Awards

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

19th June, 2018

aurawindsurfing left a reply on Display Table From Database • 4 days ago

It would probably be easier to connect to that table as a Model and not directly:

I think that here might be your problem:

$project_data = \DB::table('projects')->select('*')->get();

try to dd($project_data) and see what you are getting if anything...

I'm not sure if compact will work as expected in this case. I know that it looks like it should but try to play with it and try:

public function index()
    {
        $users = DB::select('select * from users where active = ?', [1]);

        return view('user.index', ['users' => $users]);
    }

aurawindsurfing left a reply on Help Me Understand Queue/jobs With My Project Please! • 4 days ago

Ok but the question is why does it go down? Do the limit you from accessing their servers?

The only difference you will achieve with jobs is that you might queue all of the houses as a separate job and then see them go in laravel horizon. But you can do the same with scheduling your command every minute I guess.

It all depends on what type of access you have to those machines. What I understand is that you do not controller them and do not have access to their databases?

Cheers!

18th June, 2018

aurawindsurfing left a reply on Help Me Understand Queue/jobs With My Project Please! • 4 days ago

It sounds like you are looking at automating those tasks. The easiest way would be to create commands: https://laravel.com/docs/5.6/scheduling#scheduling-artisan-commands, they run similar to cron or actually are cron, just much nicer ;-)

Commands have nothing to do with Jobs and Queues. Queue would be for instance when you have an email notification and you do not want to wait until you get confirmation that email was send. You put use Queueable; on top of the notification. To use them you need to start at least one Queue worker on your server.

I also wonder if you need to do those tasks in specific order? Is it one DB? With commands you can actually do a small trick and call another server endpoint and run an url, this way you would keep everything on one server in one command. It will look something like that:

namespace App\Console\Commands;

use Illuminate\Console\Command;

class Test extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'my:test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Test another endpoint with curl';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $curl = curl_init();

        curl_setopt_array($curl, array(
        CURLOPT_URL => "https://myotherapp/test",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_HTTPHEADER => array(
            "Cache-Control: no-cache"
        ),
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);

        curl_close($curl);

        if ($err) {
        echo "cURL Error #:" . $err;
        } else {
        echo $response;
        }
            }
}

Hope it helps!

aurawindsurfing left a reply on Fresh Install Of MacOS High Sierra (13.1) With Laravel Valet, PHP, And Oracle (OCI8) • 4 days ago

Hi @jdm34

I was trying to match my version of Oracle XE which is 10.2 and my pecl installation was not working properly, then I tried to use the latest 12.2 and it worked with 10.2 DB, that was the first issue.

Second was to actually test the connectiion, I use additional ssh tunell so I used sqlplus and tested the connection that way. This allowed me to tick those boxes and move on to another oci8 module. The trick is that valet restart does not work as expected and I had to do valet start/stop and also brew services php71 restart to actually enable oci8 extension

Finally when I was sure I have oci8 is running I added yajra/laravel-oci8.

That is it more less. I have to say that I wrote tutorial for myself and will probably appreciate it in few months ;-)

Thank you again for documenting the steps!

aurawindsurfing left a reply on Laravel Translation In Vue • 4 days ago

Ok what you can do it this:

composer require mariuzzo/laravel-js-localization

Generate your translation json file with:

php artisan lang:js --json

Then I assume you use 5.6 in your app.js add following:

import translations from '../../lang/vue-translations.json'
Vue.prototype.$translations = translations;

(I put my translations file in the lang folder but you can put it whenever you like)

then in my Vue Component I use it like so:

<div class="label">{{ locale == 'en' ? workday.weekday : $translations[locale +'.strings'][workday.weekday] }}</div>

I pass locale as a prop from blade as it is the simplest way:

<my-component>
locale="{{ App::getLocale() }}"
</my-component>

There are a lot of packeges that do it but I keep my files in translation json files and not in standard key => value files so this method works for me for both.

I hope it helps.

13th June, 2018

aurawindsurfing left a reply on Fresh Install Of MacOS High Sierra (13.1) With Laravel Valet, PHP, And Oracle (OCI8) • 1 week ago

Hey @jdm34 I wonder if you are still active on this forum. I have a problem connecting to my Oracle instance. I'm able to do it from navicat, datagrip no probs but now from the PHP itself. What would be the best way to troubleshoot the connection, please?

12th June, 2018

aurawindsurfing left a reply on Ajax Request, • 1 week ago

Are you getting any value from?

$request->input("origin");

aurawindsurfing left a reply on Unexpected Behavior Of Laravel On Curl Request • 1 week ago

Just call that function directly or from command line curl or from postman and see what you get.

11th June, 2018

aurawindsurfing left a reply on MySQL Connection Via SSH In Laravel • 1 week ago

Hi @Bubba Hines is there any way to use SSH user/password instead of ssh key please?

10th June, 2018

aurawindsurfing left a reply on Form Model Binding • 1 week ago

This at first seems like a good idea until you start asking yourself exactly those questions.

I did not use for model binding but my common sense tells me that if it does not match exactly, then it is not much of a use to you.

If you have so many forms, why not create it from blade partials or vue components or some other similar way?

aurawindsurfing left a reply on Guide: Solving Common Public Key Problems In Laravel Forge • 1 week ago

Looks to me like a solution to a nonexisting problem ;-)

aurawindsurfing left a reply on Laravel Translation In Vue • 1 week ago

You can pass already translated arguments to vue from blade with props like so:

<component
    name="@lang($user->name)"
></component>

and then use it within vue:

<template>
     <h4>{{name}}</h4> 
</template>

<script>
    export default {
        
        props: {
            name: String,
        }
    }
</script>

aurawindsurfing left a reply on How To Display "You Need To Login First" • 1 week ago

You can either do it it routes file with:

->middleware('auth');

or directly in a Controller with:

public function __construct()
    {
        $this->middleware(['auth']);
    }

9th June, 2018

aurawindsurfing left a reply on Is It Advisable To Hash Ids In Url? • 1 week ago

Eh never easy, right?

5th June, 2018

aurawindsurfing left a reply on Maintenance Mode With --allow=[ip] Behind Load Balancer Doesn't Work • 2 weeks ago

It is probably due to the order of middleware in your app:

If you want to use trusted proxy prior to maintenance middleware then just change the order like so:

  protected $middleware = [
        \Fideloper\Proxy\TrustProxies::class
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    ];

4th June, 2018

aurawindsurfing left a reply on Loop Through A Collection Set • 2 weeks ago

Hi,

You are not looping a collection but an array.

When you do dd() does it say collection or array? If you want to create collection then you need to collect wit like so:

collect(your_array);

and then it will behave like a collection, more about it here:

https://laravel.com/docs/5.6/collections

look for creating collections

aurawindsurfing left a reply on Horizon Not Processing Queues • 2 weeks ago

It looks like you do not have a queue worker running. If you use Forge, it is in site configuration under queue tab.

Start at least one queue worker and see if they will show up. Laravel itself does not process the queue, it needs a process running on the server to do this.

That is my guess.

aurawindsurfing left a reply on How To Properly Assess Max Nb Workers Permitted By A Server (ex: Digital Ocean) To Treat A Queue Of Hundreds Jobs? • 2 weeks ago

Probably similar to max-childern in PHP-fpm.

Just go to terminal and see how much memory one process consumes, leave some room to breathe and the rest you can use for your tasks. It is just a simple thinking but I remember this is how I was doing it with php children.

https://myshell.co.uk/blog/2012/07/adjusting-child-processes-for-php-fpm-nginx/

aurawindsurfing left a reply on Passing Properties To Map Code • 2 weeks ago

My exmaple is used inside vue but you can see for it how to do it:

var mymap = new GMaps({
                        el: '#map',
                        lat: '{{$classified->geo['lat']}}',
                        lng: '{{$classified->geo['lng']}}',
                        zoomControl: true,
                        mapTypeControl: false,
                        scaleControl: false,
                        streetViewControl: false,
                        rotateControl: false,
                        fullscreenControl: false,
                        zoom:9
                    });
                            

aurawindsurfing left a reply on Many To Many - Relational Database For Students/courses • 2 weeks ago

In Laravel, you use models to define that relationship and its conditions. Database tables are there only to hold correct data and not to define relationships. Even the keys on database tables could be incorrect as you can define them in the Model itself.

In other words, you should look at the Models and not the database tables so much.

aurawindsurfing left a reply on Show Default Image When There Is No Image For The Post • 2 weeks ago

Ah sorry did not get the question right ;-)

aurawindsurfing left a reply on Show Default Image When There Is No Image For The Post • 2 weeks ago

This is not an error.

Try to display image, if does not exist display test.png

This is not an error, this is a feature ;-)

aurawindsurfing left a reply on How To Load Jquery Plugin/script When Vue Router Changes Page? • 2 weeks ago

Maybe load it for all the pages, just mix it in into app.js the will be available everywhere.

aurawindsurfing left a reply on Laravel 5.6 With Maildev, Error Code #111 • 2 weeks ago

Since Laravel 5.6 (I think) you can pass Mailable directly to the view to preview it. No need for use of that package anymore I think:

https://laravel.com/docs/5.6/mail#previewing-mailables-in-the-browser

aurawindsurfing left a reply on I Am Confused Please Give Me Some Tips • 2 weeks ago

For starters focus on one JS framework like vue.js

Build something simple.

Tackle problems one by one.

Other than that I'm not really sure what you struggle with.

aurawindsurfing left a reply on Maintenance Mode With --allow=[ip] Behind Load Balancer Doesn't Work • 2 weeks ago

I use this package which I believe now is included in new Laravel:

https://github.com/fideloper/TrustedProxy

I'm not too sure if it will do the trick for maintenance mode.

30th May, 2018

aurawindsurfing left a reply on Translate The Website Using Google Translate Api • 3 weeks ago

Hi,

The ddctd143 package is no longer active for some reason. I have written to the author without a replay, so here it is:

https://github.com/aurawindsurfing/google-translate

Enjoy!

27th May, 2018

aurawindsurfing left a reply on Can You Use Notifications Without A Model? • 3 weeks ago

On Demand notifications were introduced in 5.5, just in case anyone is wondering why older app does not work.

15th May, 2018

aurawindsurfing left a reply on Plug&play Translation Package - No More Translation Pain ! • 1 month ago

Hi,

Not yet. I actually tried text master as your root translation service.

Thanks for all the info, I'll keep the package in mind.

14th May, 2018

aurawindsurfing left a reply on Display The Values Of A JavaScript Code In A Table • 1 month ago

You can pass param to your route and then handle it here. You can also pass param to your session and check if it exists in this controller before you display the list. Finally you can do it with JS like vueJS

It is really up to you.

public function create()

{
    $client = client::orderBy('id', 'asc')->get();
    $metiers = metier::orderBy('id', 'asc')->get();
    $technicien = Technicien::orderBy('id', 'desc')->get();
    $tarifications = tarificationtache::orderBy('id', 'desc')->get();

    return view('intervention.create')->with('technicien', $technicien)->with('client',$client)- 
>with('metiers',$metiers)->with('tarifications',$tarifications);
}

11th May, 2018

aurawindsurfing left a reply on Display The Values Of A JavaScript Code In A Table • 1 month ago

If I can suggest something, since I guess you are starting with laravel - throw away all javascript for the moment. Get it to work on a regular page reload and then move on to javascript. That will be much much simpler to follow for you and to understand.

My experiance is that users do not care that much about all the bells and whistles as long as it works ;-)

Also if you decide to go javascript route use vuejs it is much clearer and nicer to work with, there is a good reason lots of people talk about it ;-)

if you have spend last 4 days on it, stop what you are doing and try to look at it from a perspective - you will find the solution ;-)

aurawindsurfing left a reply on Plug&play Translation Package - No More Translation Pain ! • 1 month ago

What is more usual and what is not?

aurawindsurfing left a reply on Plug&play Translation Package - No More Translation Pain ! • 1 month ago

bing/google/yandex and some internal deep learning for more usual translations

This is worrying to me already. No human?

aurawindsurfing left a reply on Plug&play Translation Package - No More Translation Pain ! • 1 month ago

Can you explain in a nutshell how your service works please? I mean how translations are being submitted, updated etc?

aurawindsurfing left a reply on Plug&play Translation Package - No More Translation Pain ! • 1 month ago

Hi @bleduc I have to say this is really interesting. Well done!

What I have done recently with my translations - I have extracted everything to one json.pl file which contains everything for a website. I understand that it does not matter for your service as you will feed all json and non json language files for translation from /resources/lang folder right?

aurawindsurfing left a reply on Display The Values Of A JavaScript Code In A Table • 1 month ago

Hi Again! ;-)

The easiest way would be to use vuejs and pupulate your html with vuejs binding like so:

<div id="app">
  {{ message }}
</div>

more here: https://vuejs.org/v2/guide/

aurawindsurfing left a reply on How To Autofill Form With Id From The Previous Form • 1 month ago

Ok, what you are looking for is http_requests (non persistent), cookies or session.

The way to do it would be to save the form in one of above 3 and then fetch it while you press the button. What you have to understand is that http_requests will live only for one browser refresh and then they are gone, so it all depends on your flow.

Here is a nice package that will allow you to understand them better: https://github.com/barryvdh/laravel-debugbar

Hope it helps!

aurawindsurfing left a reply on Showing The Image Of A Single Post. • 1 month ago

I mean that it shows what you tell it to show. Try to catch your $post with

dd($post);

and see what the view actually gets. Maybe you are not giving it correct info?

1st May, 2018

aurawindsurfing left a reply on Artisan Scheduled Job Emails • 1 month ago

You did start scheduler but you have no commands specified to run.

Have a look here: https://stackoverflow.com/questions/30700396/laravel-no-scheduled-commands-are-ready-to-run

aurawindsurfing left a reply on Bulk Variables Validation • 1 month ago

Just put them in array and validate the all elements of that array;

https://laravel.com/docs/5.6/validation#validating-arrays

$validator = Validator::make($request->all(), [
    'yourVarsArray.*' => 'required|numeric',
]);

30th April, 2018

aurawindsurfing left a reply on Showing The Image Of A Single Post. • 1 month ago

How are you setting $post variable? It is all in there. You decide what it should be.

aurawindsurfing left a reply on Laravel Intervention Image Cache Not Working On Server • 1 month ago

Did you do this on production?

php artisan storage:link

https://laravel.com/docs/5.6/filesystem

aurawindsurfing left a reply on Laravel Socialite Not Completely Destroying Session • 1 month ago

Maybe just log out of your facebook and try again after that?

aurawindsurfing left a reply on Get Id Automatically • 1 month ago

ke? ;-)

aurawindsurfing left a reply on TokenMismatchException For Tests • 1 month ago

@AlexGodbehere I do not see a reason it should be disabled. Your tests should behave the way your application does.

29th April, 2018

aurawindsurfing left a reply on How To Encrypt My Id In URL Like This. • 1 month ago

You can create unique slugs for groups, this is one option. The second would be not to hide anything and protect it with moddleware so user without privileges can not access such group at all.

aurawindsurfing left a reply on -> Keybinding In VSCode • 1 month ago

Ended up using Alfred with snippets and autocompletion. For some reason drives me crazy to press so many buttons only to get ->

?

17th April, 2018

aurawindsurfing left a reply on Cloudflare And Laravel • 2 months ago

I started to use cloudflare for everything, such a timesaver! Need less to say if you decide to pay 20 per month you get the whole lot of goodies, it is amazing how many people actually try to get to your server ;-)

Edit Your Profile
Update

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