aurawindsurfing

aurawindsurfing

Laravel Newbie at @

Member Since 3 Years Ago

Dublin, Ireland

Experience Points
202,530
Total
Experience

2,470 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
1031
Lessons
Completed
Best Reply Awards
135
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 41
202,530 XP
Sep
09
1 week ago
Activity icon

Replied to Selecting The Data In The Dropdown View In Laravel

It will come to your controller after you submit for as a $request this is where you can access those values from the form.

Activity icon

Replied to How To Query This To Get The Desired Output Table In Raw SQL Query?

That depends what you desire my friend ;-)

Activity icon

Replied to Access Denied For [email protected]

There should be option to create users in tableplus - I never used it and assign priviliges to users as well. you user is root so in theory it should have all priviliges for the DB it creates but you never know.

Activity icon

Replied to Access Denied For [email protected]

  1. Make sure mysql is running
  2. Make sure you have database created
  3. Make sure you have user for that database created
  4. Make sure that that user has all the privilages for that database.

Then try to connect

Sep
03
2 weeks ago
Activity icon

Replied to Not Rendering Exceptions (hitting Maximum Execution Time Instead)

@jimmyv There is no exeption then, the codee keeps running until it run out of execution time.

If there was exeption the code will not run. You have created a loop of some sort or something that just takes super long time on each page load.

Activity icon

Replied to Granular Eloquent Search With Multiple Where And Wherein Issue

Hey @boubou

First of all listen to this podcast episode. There are some cool explanation of query builder vs eloquent ORM which is the issue here: https://pca.st/5scdurn0

To make long story short you need to have eloquent collection to use whereIn or orWhereIn and so on. You try to use query builder here that does not have those methods available. You will be able to use those methods after you call ->get() at the end of query and then apply those methods to resulting collection. Have a look here: https://laravel.com/docs/master/queries#retrieving-results

Anyhow replying to your question:


$flights = App\Models\Flight::all();

$your_result = $flights->whereIn('type', $type)
                        ->orWhereIn('category1', $data1)
                        ->orWhereIn('category2', $data2)
                        ->where('subcategory', $data3)
			->get();

Hope this helps.

Or even simpler:

$your_result = App\Models\Flight::whereIn('type', $type)
                        ->orWhereIn('category1', $data1)
                        ->orWhereIn('category2', $data2)
                        ->where('subcategory', $data3)
			->get();
Aug
25
3 weeks ago
Activity icon

Replied to Adjust Laravel Hashing Algorithm

@oswin as @snapey said you would have to overwrite authentication method in LoginController and this way make laravel use your own hashing to match.

Activity icon

Replied to Adjust Laravel Hashing Algorithm

Hey @oswin

Here is where you can configure hashing in laravel: https://laravel.com/docs/master/hashing#configuration as you probably know already.

This is correct way to match your hashing as well:

'password' => Hash::make(hash('sha256',$data['password'])),

So you are on a good track. The only missing thing is to make sure that when you publish:

composer require laravel/ui

php artisan ui vue --auth

The Controllers are working working given Hashing mechanism.

Aug
21
1 month ago
Activity icon

Replied to Is Blade Component Basically Livewire?

@robertwt7

Livewire will have 2 way data binding.

Blade components are just wrappers around some pieces of blade. Nothing to do with data bindings as far as I understand.

Hope it helps!

Aug
17
1 month ago
Aug
12
1 month ago
Activity icon

Replied to List All Courses

He is right in saying it is not listed here: https://laracasts.com/browse/tooling

Try also type into google:

"site:laracasts.com" xxxxxx

where xxxxxxx is the expression you are looking for

Aug
11
1 month ago
Activity icon

Replied to Need To Track And Monitor Oracle DB Connection

@johnw65 Laravel can work with Oracle but it is not as straight forward as it might seem.

Oracle instance has users table but to use this credentials to log into you web app is will be quite tricky as you have to know what hashing mechanism was used and etc.

It will be much simpler to use emails of users and generate passwords for them.

Why your uses have direct access to database anyway?

Aug
10
1 month ago
Activity icon

Replied to Setting Multiple Domains For A Route Group

If it is in your code or views that you are looking for more elegant solution, then use names routes like so: https://laravel.com/docs/master/routing#named-routes

This will work regardless of how many things you have appended.

Activity icon

Replied to Intelligent Route Model Binding / Relation Loaded Twice

@t0berius I get the point but when you look at your code in one year time you will think to yourself "%$$#@$$ I was thinking" ;-)

Just step back for a second and look at complexity of your code. Since you have a relationship once you have stockItem you also have adminProduct and vice versa. If you want to avoid double querying then you can eagerload the relationship: https://laravel.com/docs/master/eloquent-relationships#eager-loading

Activity icon

Replied to Intelligent Route Model Binding / Relation Loaded Twice

@t0berius

I would simply do it that way. Laravel takes care of all the rest, there is no point rewriting whole routing since this is exactly what model binding is doing anyway:

Do 2 routes:

Route::get('/product/{adminProduct}, [email protected]')
Route::get('/product/{adminProduct}/stock/{stockItem}, [email protected]')

or even better:

Route::get('/product/{adminProduct}, [email protected]')
Route::get('/stock/{stockItem}, [email protected]')
Activity icon

Replied to Stripe CLI Sends Webhooks With Fake Data, How Am I Supossed To Test My Integration

@gabotronix maybe this is stupid, but are you not in "sandbox", "test data" mode?

Activity icon

Replied to Sending \Illuminate\Mail\Mailable With Laravel's Notifications

@halloei First thing to check is if you have email on your users table: https://laravel.com/docs/master/mail#sending-mail or in this case orders table.

If you pass an object or collection of objects, the mailer will automatically use their email and name properties >when setting the email recipients, so make sure these attributes are available on your objects.

The second before you try digging is to configure something to actually catch your emails. I use this app: https://usehelo.com/

You can also use mailtrap: https://laravel.com/docs/master/mail#mail-and-local-development or any other varation of it. Then you can start tracking your emails ;-)

Activity icon

Replied to Help Me Do A Foreach Statement To Return Unique Value Only.

@ri or even simpler keep your data in one place. Keep numbers together with country codes and names in one collection like so:

$allCountries = collect([
  [
    'code' => 'DE',
    'name' => 'Germany',
    'phone' => null
  ],
  [
    'code' => 'US',
    'name' => 'United Stated',
    'phone' => '+1'
  ],
  [
    'code' => 'UK',
    'name' => 'United Kingdom',
    'phone' => '+44'
  ]
]);

Then you can do:

$countries = $allCountries->whereNotNull('phone')->unique('phone');

Which will result in:

=> Illuminate\Support\Collection {#986
     all: [
       1 => [
         "code" => "US",
         "name" => "United Stated",
         "phone" => "+1",
       ],
       2 => [
         "code" => "UK",
         "name" => "United Kingdom",
         "phone" => "+44",
       ],
     ],
   }

Here yo can play with this code: https://web.tinkerwell.app/#/snippets/9612a8a9-d93f-4ed2-81c7-aa408f86560f

Activity icon

Replied to Store Users Selected Language Option

@snapey good example of sessions vs cookies usage

Aug
09
1 month ago
Activity icon

Replied to Vapor AWS IAM Access Denied

@skoobi AWS is not as nice documented as Laracasts, thats for sure!

Try looking up users policies, group policies, see if any of them works. Other then that since Vapor is paid service - I would write to the support, simple solitions are best!

Activity icon

Replied to Store Users Selected Language Option

@norbertho This is how session should work. It is not a bug, it is feature.

Think about it, one user logs out then there should be no session associated with him or his browser. He is a guest and should receive default guest settings.

Aug
08
1 month ago
Activity icon

Replied to Setting Multiple Domains For A Route Group

Hey @g89angel

The problem now is all my routes aren't working as before since the first parameter received is the $domain, which is not what I expected.

What did you expect to get? This is expected behaviour where $domain is being preppend with the route group.

Activity icon

Replied to How To Convert Vue Bootstrap To Normal Bootstrap.

  1. Remove all bootstrap classes.
  2. Remove bootstrap.
  3. Install tailwindcss
  4. Enjoy life
Aug
06
1 month ago
Activity icon

Replied to CSRF TOKEN Mismatch Exception Laravel 5.8?

419 is CSRF mismatch, clearly it thinks request comes with wrong token or not token at all.

Aug
05
1 month ago
Activity icon

Replied to Type Must Be 'string' (as In Base Class '\Illuminate\Database\Eloquent\Model')

@mateusgalasso

Quite stupid but it clearly says it is not getting string what happens when you

dd($table);

What do you get?

Aug
04
1 month ago
Activity icon

Replied to PHPStorm Code Style - Blade Braces

As far as I know there is not a solution for it.

if you really really can not code without it then you can use:

https://www.alfredapp.com/help/features/snippets/

I use it for instance for replacing option+. with -> and option+= with => for somea reason I can not live without it!

Besides that Alfred is also really good for searching laravel docs with this plugin: https://laravel-news.com/laravel-docs-alfred

Activity icon

Replied to How To Send Updates To Multi-tenant Websites

@muhammednasser

How did you structure your application?

Ad. 1 Simply push changes to your repo, all changes will apply to all apps within.

Ad. 2 What do you mean?

Activity icon

Replied to Giving Users An Update Option From The App

This is probably the better advice, but does not answer the question :-)

Activity icon

Replied to Giving Users An Update Option From The App

Hey @martinzeltin

What you could do is allow them to call a method in controller which in turn will execute something like that:

shell_exec('git pull origin/master && artisan migrate');
Activity icon

Replied to Optimize Laravel Export Time

Don't do that.

Put it on a que and send it b email. Or have it waiting for user in their login panel when they log in.

Activity icon

Replied to AssertSee Not Working

@nickywan123

Yes this is exactly it no route post in my web.php

And this is exactly what the error was:

The POST method is not supported for this route

;-)

Activity icon

Replied to AssertSee Not Working

Yes or it changes the actual error to something that you better understand.

Whats the error now? Also with assert see scroll all the way to the bottom of HTML this is where it says what it failed to see.

Aug
03
1 month ago
Activity icon

Replied to AssertSee Not Working

@nickywan123

  1. What is the error at the moment?

  2. You are actually creating 2 threads:

First one here:

$thread = factory('App\Thread')->create();

Then you try to create identical here:

$this->post('/threads', $thread->toArray());

What is probably causing the error since it already exists.

Try removing the second line to check. It should not fail.

For your test to make sense however you need this line so what I would do is to go back to your initial solution and see but tweak it to:

$this->post('/threads', [
'title' => 'foo',
'author_id' => 'bar'
]);

This will have the same effect without using the factory.

Also read those errors and address them one by one once you eliminate them this is where

$this->withoutExceptionHandling();

comes really handy.

Activity icon

Replied to Nova: Users Not In Menu

@mb

if you created policy for User model then yes: https://nova.laravel.com/docs/1.0/resources/authorization.html#policies

See who can see users:

public function view(User $user, User $model)
    {
        return $user->role == 'admin';
    }

In this case only users with role admin can see them.

Maybe you created policies but have no matching roles?

Hope it helps!

Activity icon

Replied to AssertSee Not Working

@nickywan123

make() does not persist model in database: https://laravel.com/docs/7.x/database-testing#creating-models you need to call save() to persist it.

create() makes model and saves it to the database: https://laravel.com/docs/7.x/database-testing#persisting-models

Hope it helps!

Activity icon

Awarded Best Reply on [Homestead]Easiest Way To Currently Run A Legacy Project?(Laravel 4.2/php 5.6)

Hey @alphyo

You need to have multiple versions of PHP installed in your Homestead box and switch between them.

Have a look at this post: https://stackoverflow.com/questions/41804727/using-laravel-homestead-for-php5-6-and-php7-projects

Once you have correct version of php installation of 4.2 should work.

I would however consider paying few bob for https://laravelshift.com/ and making the most of laravel.

Enjoy!

Activity icon

Replied to AssertSee Not Working

@nickywan123 100% it did not ;-)

It says it did not:

The POST method is not supported for this route

Unless you are looking in wrong place ;-)

Activity icon

Replied to [Homestead]Easiest Way To Currently Run A Legacy Project?(Laravel 4.2/php 5.6)

@bugsysha if app does not have really good test base then you will have no way of knowing if it properly works. Up to you at the end of the day.I always go the easy way. Whats the point of sticking with 4.2 anyway.

Activity icon

Replied to AssertSee Not Working

@nickywan123

It fails in different place. It fails to create actual thread:

$this->post('/threads', $thread->toArray());

The error is clear:

The POST method is not supported for this route
Activity icon

Replied to AssertSee Not Working

Hi @nickywan123

Add at the beginning of your test:

$this->withoutExceptionHandling();

Also look at the very very end of your HTML message in the console, this is where you will see your error.

Activity icon

Replied to Not Allowed To Load Resource

What is a "Chrome Server"?

Activity icon

Replied to [Homestead]Easiest Way To Currently Run A Legacy Project?(Laravel 4.2/php 5.6)

But really it will be much better to upgrade your project then to linger with 4.2 for no reason.

Activity icon

Replied to [Homestead]Easiest Way To Currently Run A Legacy Project?(Laravel 4.2/php 5.6)

@bugsysha I doubt it. I think it will work with 5.6 but not 7.0 probably.

https://laravel.com/docs/4.2/releases

It is ok to have php 5.6 and 7.4 installed on one Homestead. As per the link I send earlier:

In your Homestead.yaml file you can set the version:

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public
      php: "5.6"
Activity icon

Replied to [Homestead]Easiest Way To Currently Run A Legacy Project?(Laravel 4.2/php 5.6)

Hey @alphyo

You need to have multiple versions of PHP installed in your Homestead box and switch between them.

Have a look at this post: https://stackoverflow.com/questions/41804727/using-laravel-homestead-for-php5-6-and-php7-projects

Once you have correct version of php installation of 4.2 should work.

I would however consider paying few bob for https://laravelshift.com/ and making the most of laravel.

Enjoy!

Aug
02
1 month ago
Activity icon

Replied to Git Modules

Two modules of what? Show your folder structure, please.

What do you mean by: "I can't enter the front-end folder"

The commands you gave should be ok, this should be your actual github origin:

git remote add origin someuser/somerepository

Hope it helps!

Activity icon

Replied to Auto Page Break In Dompdf Is Not Working Fine Need Help.

Hey @deepak379

Add this at the end of your html it will always produce new page after it, omit it in your last page:

<div style="page-break-after:always;">

Hope it helps!

Jul
30
1 month ago
Activity icon

Replied to Update Different Table Inside A Nova Resource

eaxctly what the package I gave you does

Activity icon

Awarded Best Reply on When I Run "npm Install" Then Many Error Occurs How Can I Solve This

I have a nice alias for that:

alias fucknpm='rm -rf node_modules && rm package-lock.json && npm cache clear --force && npm install'

then I run:

brew install yarn
yarn install

And usually everything works ;-)

NPM could be a pain ;-)

Activity icon

Replied to Scout/Algolia — Factory Fails To Save Relationships To Index

Hey @delon

How many do you try to create with Factories? Maybe you are just unlucky and never create supplier

'type'  => array_rand(['supplier', 'buyer']),

Therefore there are no products

if($user->type==='supplier') {
        // create five products for them
        $products = factory(App\Product::class, 5)->create();

        $products->each(function($product) use ($user) {

            $user_product = factory(App\UserProduct::class)->create([
                'product_id' => $product->id,
                'user_id' => $user->id
            ]);

        })->each(function($product){
            $product->setUserProductCount();
            $product->update();
        });
    }

I also use:

'type' => $faker->randomElement(['supplier', 'buyer']),

Instead of

'type'  => array_rand(['supplier', 'buyer']),

Not that it makes the difference but looks nicer to me ;-)