Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

aurawindsurfing

aurawindsurfing

Laravel Newbie at @

Member Since 3 Years Ago

Dublin, Ireland

Experience Points
202,960
Total
Experience

2,040 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,960 XP
Nov
18
1 week ago
Activity icon

Replied to Implode(): Passing Glue String After Array Is Deprecated

This error also exists if you are using php 7.4 while your project should be running on php 7.3 which of course is equivalent to update of laravel to version 7 ;-)

Nov
02
3 weeks ago
Activity icon

Replied to SignedRoute + Livewire Route

Yes middleware works as expected if I replace Livewire controller with regular one. I think it might be related to how Livewire handles request itself. Similar to not being able to use Form Requests in Livewire.

Activity icon

Started a new Conversation SignedRoute + Livewire Route

Can anyone suggest how to make one page Livewire Component routing work with signed temporary URL's, please?

My route looks like this:

Route::get('/test/{model}', ShowForm::class)
    ->name('form')
    ->middleware('signed');

My Livewire controller simply returns view but I'm getting 404 error. The problem is in middleware and it works when I remove it. Not sure if anyone got it to work already?

Thanks!

Oct
08
1 month ago
Activity icon

Replied to How To Filter Paginated Results?

You should apply filter before paginating results. Think of pagination as a view. First you get data then you pass it to the view.

Activity icon

Replied to Set Default Value To A Date Field (in Migration)

Whats the difference between now(); and CURRENT_TIMESTAMP? Quick google returned that they are the same thing: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_current-timestamp

Activity icon

Replied to Set Default Value To A Date Field (in Migration)

$table->date('data')->default(date("Y-m-d H:i:s"));

It has to be timestamp.

Oct
04
1 month ago
Activity icon

Replied to Laravel - Load Different .env File

I think it was depreciated in version 5. The way to do it is to use:

APP_ENV=local
APP_ENV=production

in your single .env file.

Can you not put the correct .env on the actual production server?

Oct
02
1 month ago
Activity icon

Replied to Make Laracasts Score 100% With PageSpeed Insights?

@automica think of if like s3 but with automatic resizing and some really cool transfarations of images out of the box https://cloudinary.com/documentation/image_transformations

Activity icon

Replied to Make Laracasts Score 100% With PageSpeed Insights?

@automica got it!

I agree with public / subscribers site argument. I personally found that by implementing https://cloudinary.com I have made a huge different to my classifieds site. It basically takes care of everything regardless of end user device.

Its an easy fix as well.

Activity icon

Replied to Make Laracasts Score 100% With PageSpeed Insights?

@automica yeah looks like no many people care about pagespeed anyway! My SEO lads are saying otherwise but go figure!

Activity icon

Replied to Filter By County Name Nova

Hey @myirlik

The reason is that your pluck does not return key => value array but only an array of values.

Have a look here: https://laravel.com/docs/master/helpers#method-array-pluck and here https://nova.laravel.com/docs/1.0/filters/defining-filters.html

The options method should return an array of keys and values. The array's keys will be used as the "human- friendly" text that will be displayed in the Nova UI. The array's values will be passed into the apply method as the $value argument.

So the simplest solution will be:

public function apply(Request $request, $query, $value)
    {
        return $query->where('id', 'name')->get();
    }

    /**
     * Get the filter's available options.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function options(Request $request)
    {
       
        return [
		'City' => 'name'
		];
    }

Hope it helps!

Sep
29
1 month ago
Activity icon

Replied to Add Subtitles On Laracast Lessons

Yeah but I get his point, should be easy done from laracasts perspective. Since they are hosted on vimeo here is the vimeo way of doing it:

https://vimeo.zendesk.com/hc/en-us/articles/224968828-Captions-and-subtitles

And there is also this nice service to create them: https://www.descript.com/

I'm just saying it is a valid point and doable by all means.

Activity icon

Replied to Pusher With Multy-tenancy

One pusher account and then channels for apps/tenants/users you name it.

There is no way one will be able to access different one similar to way the sessions work for users. You decide who subscribes to what channel, there could be also one channel per user, it is completely fine.

Or when 2 users have conversation then you subscribe 2 of them to that channel and so on.

Hope it helps!

Activity icon

Started a new Conversation Make Laracasts Score 100% With PageSpeed Insights?

Ok, here is a theoretical question: How to make laracasts score higher with PageSpeed Insights? Or maybe it clearly shows we should not worry about it at all? Here are the results:

https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Flaracasts.com%2F

and here are results from GTmetrix as well:

https://gtmetrix.com/reports/laracasts.com/tMDCPtQd

What do you guys think?

I'm surprised laracasts is not using service such as cloudinary to minimise size of images not to mention compression. This seems like a clear win straight away.

Sep
22
2 months ago
Activity icon

Replied to Laravel Sanctum Could Not Authenticate Me Through TOKEN To Access A GET Route.

Hey @alex96

Most of the time errors will tell you 90% of where the problem is, if it says Unauthenticated then it means exactly that. You can not visualize anything because you are not authorized to access eg. your token is not valid.

You probably missed some small thing. First try to get postman to access a public route without any token. Make sure that works.

Then try to access the same route but wrap it in protection.

Step by step you gonna get there!

Give us some error examples, please!

Sep
09
2 months 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 months 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 months 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
3 months 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
3 months ago
Aug
12
3 months 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
3 months 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
3 months 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
3 months 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
3 months 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
3 months 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
3 months 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
3 months 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
3 months 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!