aurawindsurfing

aurawindsurfing

Member Since 2 Years Ago

Dublin, Ireland

Laravel Newbie at @

Experience Points 116,760
Experience Level 24

3,240 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 655
Lessons
Completed
Best Reply Awards 67
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

16 Mar
4 days ago

aurawindsurfing left a reply on Excluding Algolia Results Based On Dates Values

Seems like not such a good solution to me ;-)

aurawindsurfing left a reply on Laravel In Docker Using Storage Symlink

My guess is that it is not docker related.

browser uses

url('path/to/file)

Mail uses absolute path as you would reference that file in a linux operating system like so:

storage_path('path/to/file)

dd() both examples in both environments and you will see the differences.

Hope it helps!

11 Mar
1 week ago

aurawindsurfing left a reply on Nginx Logs Per Webapp?

@gabotronix but why you want this and need this?

Just create your own log and log everything you need in there. There are few nice bug tracking SaaS services like:

Understand.io Rollbar.com

to name few

aurawindsurfing left a reply on Excluding Algolia Results Based On Dates Values

I think in algolia you can set parameters over which you want to search and their importance.

Then you just do a normal query from Vue or from Eloquent taking in accounts your publish_to date should work without any issue.

Hope it helps!

aurawindsurfing left a reply on Two Laravel Apps On Same Browser

Hmm when you were creating the second app did you just copy the app folder?

If so then you probably have the same key for the app and therefore the same sessions.

Try doing php artisan key:generate

Hope it helps!

02 Mar
2 weeks ago

aurawindsurfing left a reply on Laravel Redirect To Custom Page Instead Of An Article Using Slug

Two ways I can think of this is:

  1. Encapsulate the route groups in middleware that at the end calls specific controller? But this is probably not the right way to do this.

  2. Make SlugController that groups the slugs and redirects to the correct controller?

There is probably a better way to do this tough.

Hope it helps!

aurawindsurfing left a reply on How To Export Database Table To Excel File In Laravel

@KONRMS - as @jorickl said - first establish if your export works if your form works separately. Just make a test route to controller method and see it the export part works.

01 Mar
2 weeks ago

aurawindsurfing left a reply on How To Export Database Table To Excel File In Laravel

Hi,

I use this package and it works perfectly.

It seems like you are following some older tutorial. Try to follow this quick start guide: https://docs.laravel-excel.com/3.1/exports/

? Create an export class in app/Exports

You may do this by using the make:export command.

php artisan make:export UsersExport --model=User

The file can be found in app/Exports:

.
├── app
│   ├── Exports
│   │   ├── UsersExport.php
│ 
└── composer.json

If you prefer to create the export manually, you can create the following in app/Exports:

<?php

namespace App\Exports;

use App\User;
use Maatwebsite\Excel\Concerns\FromCollection;

class UsersExport implements FromCollection
{
    public function collection()
    {
        return User::all();
    }
}

? In your controller you can call this export now:

use App\Exports\UsersExport;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Controllers\Controller;

class UsersController extends Controller 
{
    public function export() 
    {
        return Excel::download(new UsersExport, 'users.xlsx');
    }
}

? Find your users.xlsx in your downloads folder!

Hope it will help you!

26 Feb
3 weeks ago

aurawindsurfing left a reply on Laravel Nova Multi Guard Auth

Why not login everyone via the same login page and use guards to show hide resources?

25 Feb
3 weeks ago

aurawindsurfing left a reply on How Do You Handle Notifications/Events

Ok so when you create an Invoice it would be an event, the same goes for deleting it and editing it.

You fire those events and then figure out who to notify about it. Then you create notification classes as needed for each scenario.

aurawindsurfing left a reply on Laravel System Stopped Working After Clear Config And Cache

After composer update did you do composer dump-autoload?

aurawindsurfing left a reply on Store Media Files Outside Laravel Project Folder.

Looks like you do not have permissions to create this directory then:

Impossible to create the root directory

Try creating it by hand on your server and see if that helps for starters.

aurawindsurfing left a reply on How Do You Handle Notifications/Events

Hi @sam

My understanding of Events vs Notifications is:

Event - something significant, like purchase, sell, deletion of a model etc. Notification - insignificant once off action to send an email or text to user or client etc.

Here is a good explanation for it: https://stackoverflow.com/questions/39314809/laravel-broadcasting-notification-vs-event

Hope it helps!

16 Feb
1 month ago

aurawindsurfing left a reply on Authentication

This is normal browser behaviour.

This is not a bug, this is a feature ;-)

aurawindsurfing left a reply on How To Storage Link Laravel Project In Live Server

You need to connect to it via ssh, then run php artisan storage:link from terminal.

11 Feb
1 month ago

aurawindsurfing left a reply on Set Custom Timestamp Column Equal To 0

Ok but why do you need it at 0000-00-00 00:00:00 just leave it blank and check in your code

isset($table->timestamp('delivered_at'));

instead of setting it to incorrect value

aurawindsurfing left a reply on Browsers Displays Sitemap As Plain Text

Nothing fancy just that:

 $sitemap = Sitemap::create()

        ->add(Url::create(url('/pl'))
            ->setPriority(1.0)
            ->setLastModificationDate(Carbon::yesterday())
            ->setChangeFrequency(Url::CHANGE_FREQUENCY_WEEKLY)
            ->addAlternate(url('/en'), 'en'))

->add(Url::create(url('/pl/kontakt'))
            ->setPriority(0.9)
            ->setLastModificationDate(Carbon::yesterday())
            ->setChangeFrequency(Url::CHANGE_FREQUENCY_WEEKLY)
            ->addAlternate(url('/en/contact-us'), 'en'));

for each site section and it works just fine

aurawindsurfing left a reply on Set Custom Timestamp Column Equal To 0

Hmm as I said maybe I'm wrong about them but my guess would be that 0000-00-00 00:00:00 value for a timestamp is somewhat equivalent to null but I have no idea tbh!

aurawindsurfing left a reply on Set Custom Timestamp Column Equal To 0

The short answer is I guess now due to limitations of timestamp:

It is after all 32-bit integer starting on 01-01-1970 00:00:00

Meaning you get range of -2,147,483,647 up to 2,147,483,647 seconds

Meaning you can not go to 00-00-0000 00:00:00 as it is too low value for this integer ;-)

I hope I got it right!

aurawindsurfing left a reply on Browsers Displays Sitemap As Plain Text

I use this spatie package for sitemaps and they work just fine spatie/laravel-sitemap maybe try to generate with it?

aurawindsurfing left a reply on Browsers Displays Sitemap As Plain Text

Must be something sill and small but I can not see it

aurawindsurfing left a reply on Auth (with Nova) Not Working On Forge

Hi @zagreus

This is not forge related issue.

Nova is by default disabled in production:

https://nova.laravel.com/docs/1.0/installation.html#authorizing-nova

Authorizing Nova Within your app/Providers/NovaServiceProvider.php file, there is a gate method. This authorization gate controls access to Nova in non-local environments. By default, any user can access the Nova dashboard when the current application environment is local. You are free to modify this gate as needed to restrict access to your Nova installation:

/**

  • Register the Nova gate.
  • This gate determines who can access Nova in non-local environments.
  • @return void */ protected function gate() { Gate::define('viewNova', function ($user) { return in_array($user->email, [ '[email protected]', ]); }); }

Hope it helps!

aurawindsurfing left a reply on Database Cannot Select Correct After Upgrading Nova To V1.3.1 From V1.3.0

The question is - what changed after you upgraded to 1.3.1?

Your config files or env files are never touched so this is not the case.

One thing that could have changed is something inside your vendor nova folder, a file that you possibly edited by hand and it got overwritten right now after the upgrade.

If this is not ht case - can you connect without nova to your database and query it?

aurawindsurfing left a reply on Browsers Displays Sitemap As Plain Text

Hmm both sitemaps look ok. They also comply with sitemap.org so it must be something else.

What happens if you swap files? Does the one with urlset still display incorrectly?

10 Feb
1 month ago

aurawindsurfing left a reply on Relationship Error

If you remove all the fields the error will surely go away.

I have seen it before in my application. Just do not remember what it was.

Just add fields one by one and see which one causes the problem.

aurawindsurfing left a reply on Use Calculated Value In Algolia

Ok then why dont you simply search algolia for records that are between the start & end date? Why do you need to calculate it? Those is just a search parameters.

aurawindsurfing left a reply on Put/Patch Via API With Powershell

I'm not sure about API calls but laravel forms only accept GET and POST resuests if you need a patch you do it like that in blade:

<form method="POST" action="patchlink">
    @method('patch')
    . . .
</form>

probably the same applies to API calls as well.

aurawindsurfing left a reply on Has Issue/question

You can either define that on mysql level as a default value for a column or listen for your model events like this:

public static function boot()
    {
        parent::boot();

        static::saving(function ($question) {

           // do something with your new question here
            }
           
        });
    }

This will apply to any save you do on a given model.

aurawindsurfing left a reply on Looking For Opinions/advice On Scaffolding An Admin CP

Hey @timgavin

If you read your question again you will see 2 contradictory statements:

  1. You try to keep the number of controllers to a minimum
  2. You try to keep the number of methods per each controller to a minimum.

This, of course, makes perfect sense at first but there are some good examples around of people who already been there and done that ;-)

Here is the best one I can think of and it is actually language and framework agnostic.

https://www.youtube.com/watch?v=MF0jFKvS4SI

Enjoy!

aurawindsurfing left a reply on Use Calculated Value In Algolia

Can you explain what it is that you have to calculate on each view?

08 Feb
1 month ago

aurawindsurfing left a reply on Sql Tooling

Looks like here is your problem:

http://php.net/manual/en/function.current.php

Changelog ¶ Version Description 7.0.0 array is now always passed by value. Prior to this version, it was passed by reference if possible, and by value otherwise.

07 Feb
1 month ago

aurawindsurfing left a reply on Pass Variable In Message Method On Rule Laravel

<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;

class Uppercase implements Rule
{

    private $err;

    /**
     * Determine if the validation rule passes.
     *
     * @param  string  $attribute
     * @param  mixed  $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        $err = $value == 24 ? now()->subDays(24) : '';
        return strtoupper($value) === $value;
    }

    /**
     * Get the validation error message.
     *
     * @return string
     */
    public function message()
    {
        return 'The :attribute must be uppercase. End expired: $err';
    }
}

this might do the trick.

aurawindsurfing left a reply on Delay Between Two Jobs

Well you are not doing 10s between jobs but 3 times 10s meaning all 3 jobs will run 10s from now.

If you increment seconds by 10 each time you run dispatch then you might get close to what you expect to achieve.

Hope it helps!

06 Feb
1 month ago

aurawindsurfing left a reply on Nova Resource Panel - Mix Cards With Panels

Hi,

Check how they are ordered. Maybe you order them as you register them, or maybe by the name of the card. Try playing around with this.

aurawindsurfing left a reply on Inner GroupBy On Collection

Hi,

Ok so rounds 16,8,4,2, final belong to one tournament right? You can have many tournaments right?

Add to your table:

ID | player1_id | player2_id | scoreP1 | score P2 | tournament_id | stage

and then:

$matches=Match::where('tournament_id', 123)->get();
$grouped_matches = $matches->groupBy('stage);

This will give you all the groups in the given tournament.

05 Feb
1 month ago

aurawindsurfing left a reply on Inner GroupBy On Collection

Cool but that is how you would do this basically.

aurawindsurfing left a reply on Nova Lenses, Search Fields

As far as I remember search is scoped by lens so just a regular search should work.

aurawindsurfing left a reply on Hide Field On Main Index But Show On HasMany Index?

Hey @timbroder

As you probably already noticed HasMany will not show on index anyway ;-)

But here is a little trick if you want to hide a relationship HasMany when it is empty:

HasMany::make('Albums')
                ->canSee(function () {
                    return $this->haveAlbums();
                }),

So if given genre hasAlbums method will return true then this relationship panel will show on your details page.

Hope it helps!

aurawindsurfing left a reply on Inner GroupBy On Collection

Hi,

You can not group this result as there will be only one stage so one group anyway.

$matches=Match::where('stage','ROUND_OF_16')->get();

You can however do:

$matches=Match::all();

$grouped_matches = $matches->groupBy('stage);

Hope it helps!

04 Feb
1 month ago

aurawindsurfing left a reply on Why Lumen Ignores Exceptions Out-of-the-box?

They are probably not activated in Lumen at all. Lumen is micro framework and not like Laravel.

aurawindsurfing left a reply on Lumen And Filesystem - Driver [] Is Not Supported

Last time I saw this error was when Storage facade was not imported correctly at the top of the file.

Make sure that works.

aurawindsurfing left a reply on 5.8 Depreciated String And Array Helpers - Thoughts

Wow, those are really interesting insights guys! I have to admit I love the docs probably a bit too much and I have completely neglected even existence of API docs ;-)

Have a great week!

03 Feb
1 month ago

aurawindsurfing left a reply on 5.8 Depreciated String And Array Helpers - Thoughts

@cronix yes it is not the end of the world definitely but for me, as a beginner, it seems bit counter-intuitive to remove them from the core. If you go to laravel.com you will see pitches like this:

Love beautiful code? We do too.

Expressive, beautiful syntax. Value elegance, simplicity, and readability? You’ll fit right in. Laravel is designed for people just like you.

We sweat the small stuff to help you deliver amazing applications.

So for me personally this is actually taking away the beautiful syntax to write beautiful code. Then it is up to a developer to sweat the small stuff back into the framework.

Of course, anyone can install it from a package but that is not the point. I think that Laravel has earned a lot of momentum thanks to small things like this that just make your life easy.

02 Feb
1 month ago

aurawindsurfing left a reply on 5.8 Depreciated String And Array Helpers - Thoughts

I like martinbean response

So will other helpers like route(), url(), view() etc be getting deprecated in the future, too?

https://github.com/laravel/framework/pull/26898

aurawindsurfing left a reply on Split Pdf Files

@eichgi do you have ready pdf files that need to be divided?

aurawindsurfing left a reply on BadMethodCallException Call To Undefined Method App\Product::products()

Is there a method in your Product model called products() or actually a relationship?

Show the code please