aurawindsurfing

aurawindsurfing

Member Since 2 Years Ago

Dublin, Ireland

Laravel Newbie at @

Experience Points 159,640
Experience Level 32

360 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 916
Lessons
Completed
Best Reply Awards 91
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

22 Jul
20 hours ago

aurawindsurfing left a reply on Charge An User Every 30 Days. (job/queue)

@zfdeveloper we are both saying basically the same thing with @snapey

  1. Put dates/subscriptions on DB tables.
  2. Iterate daily over that table to find new charges to be made.
  3. Create jobs from charges and queue them.

aurawindsurfing left a reply on Controllers And Auth Middleware!

Hi @ma

You should wrap all your routes in auth this way only authorized users can access those routes.

Then in your controllers you should verify if given user has permissions to execute given action like delete, edit etc. You can have a look at https://laravel.com/docs/master/authorization#writing-policies

Hope it helps!

aurawindsurfing left a reply on Validation Regex Assistance

Actually you can send text (sms) and verify phonenumber. You can even verify address with https://lob.com/

Now in theory you could verify an url simply by making get request to it. If you receive 200 then it works, but again since you do not run the site you have no way of knowing if it is correct.

aurawindsurfing left a reply on Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

Hey @stevenheathii

To be honest it looks a bit odd to download a file with post request, but it depends what your controller returns. It might me possible.

Can you show the whole error and also whole controller?

aurawindsurfing left a reply on Validation Regex Assistance

Why exactly do you need to validate it? To be honest, probably only the given social media site will know if an URL is valid. You can check if it starts with https or ends with .com etc but for the rest, you can not do really much about it.

aurawindsurfing left a reply on Charge An User Every 30 Days. (job/queue)

Ok that changes the perspective a bit however I would still go for a scheduled command.

Queue and jobs are not meant for storing this kind of information. Imagine you generate a job and wait for it to be executed 30 days + 30 days + 30 days and so on. Once you reset your queues you might lose data and money.

I would put all the subscription renewal dates for a client on a table. Run scheduled command every day to check what subscriptions need renewal and then run those directly or maybe put them only then on a queue if they might be taking longer to execute or be too many of them

Hope it helps!

aurawindsurfing left a reply on Validation Regex Assistance

Hi @movepixels

Are you asking how to write proper regex? I have 2 links that I always get back to. Better to write it yourself then copy something that you did not write. Regex is not that difficult but it is hard to remember. Have a look at those 2 sites:

Tutorial: https://regexone.com/

Playground: https://regexr.com/

Hope it helps!

aurawindsurfing left a reply on Charge An User Every 30 Days. (job/queue)

Hey @zfdeveloper

Simply create a command and schedule it to run every 30 days like this:

$schedule->command('your_command_name')->timezone('Europe/Paris')->->monthlyOn(1, '15:00');;

Writing commands: https://laravel.com/docs/master/artisan#writing-commands

Running scheduler: https://laravel.com/docs/master/scheduling#introduction

Scheduled commands are not Queues and are not Jobs

Hope it helps!

aurawindsurfing left a reply on Is There A Way To Use `except` And `only` On Route Groups?

@chron Just move the route in question outside of that group. No need for except or only

aurawindsurfing left a reply on How To Check A Specific Data Exists On A Relationship?

@utpal2015

$shops_without_products = Shop::whereNotIn($product->shops);

I did not test it but it should work.

aurawindsurfing left a reply on Apply DRY

@adrienpsn In this case what people usually do it to decouple your view from your laravel app. This is when you hear them saying that they only use laravel for backend. Laravel only provides API routes or endpoints if you like. And then everything you see if generated by VueJs based on json it received from api routes.

Hope it makes sense.

You are right about not wanting to duplicate your code, but maybe you are approaching it from wrong angle ?

aurawindsurfing left a reply on Laravel Controller Syntax

@gn Mark the best answer, please ;-)

aurawindsurfing left a reply on Change Email Address Location For Laravel Forgotten Password Reset

Then you would have to extend the original Laravel controller responsible for it and overwrite the logic where it refers to the email field.

aurawindsurfing left a reply on Queue Is Not Attempting To Run (attempts = 0)

Hi @ssquare

When you specify database it does not mean your local database, it means one of the following:

Beanstalkd

Amazon SQS

Redis

You do not have one of them set up and configured in config/queue.php so you queue worked does not work.

For local development change QUEUE_CONNECTION=sync and later for your production server try setting up one of the above 3 services (Redis will be the easiest one I think)

More here: https://laravel.com/docs/master/queues#introduction

Hope it helps!

aurawindsurfing left a reply on Can I Upload More Than One Image With Different Input Box Not Multi Select Option

Hi @me10071990

What do you mean only one input box is working for featured(image)

What fill happen if you change order of if statements? The other will start to work?

aurawindsurfing left a reply on Laravel Controller Syntax

Hey @gn

Any particular reason why you do not want to use Eloquent and relationships?

https://laravel.com/docs/master/eloquent-relationships

aurawindsurfing left a reply on Sessions Not Working On IOS - Session Driver Type Database Not Working Either

Hey @ruud

If you have mac, you can plug in your phone and run debug mode from safari on osx. It can then spit out all errors for you to debug it. No idea to be honest why it would not work on ios?

aurawindsurfing left a reply on Change Email Address Location For Laravel Forgotten Password Reset

Hi @nizam0786

Like with any Laravel Model. You can assign a model to a particular table in your database.

Just add this on your User model:

protected $table = 'contacts';

Now Laravel will treat your contacts table like users table.

More about it here https://laravel.com/docs/master/eloquent under tabel names

Hope it helps!

aurawindsurfing left a reply on Apply DRY

Hey @adrienpsn

I see what you are trying to do. However, Laravel has a build-in way of handling this. Have a look at web/api.php this is where all your json respinses could live and this is how you should handle API responses.

On another hand I'm not sure if you know this but if you do not return a view in Laravel controller, it returns by default a json response. So you can also use this.

API routes however is probably the right approach here.

Hope it helps!

21 Jul
1 day ago

aurawindsurfing left a reply on Permission System

Hi @afrasiyabhaider

There are quite few. I would recommend this one: https://github.com/spatie/laravel-permission

You can find more packages here: https://laravel-news.com/two-best-roles-permissions-packages

Hope it helps!

aurawindsurfing left a reply on Algorithm

Well how do you know which 5 users you need to notify in normal scenario?

20 Jul
2 days ago

aurawindsurfing left a reply on Decrement And Increment The Stock Daily

Hi @emfinanga

You can run daily scheduled command that counts all the stock.

Better cached the stock amounts for a day but invalidate cache each time you sell or get new stock.

Hope it helps!

aurawindsurfing left a reply on Best Way To Secure Healthcare Data In DB

Hey @charkhan

Due to spam this thread came up. Do you understand sharing what strategy did you use and why?

Thanks!

aurawindsurfing left a reply on Throw NotFoundHttpException Instead Of MethodNotAllowedHttpException When Route Is Not Defined!

Hi @ruvaifamasood

/passwords/reset

Hits the second endpoint with standard GET request.

Add token to your request and it will hit the first endpoint as you expect.

Hope it helps!

19 Jul
3 days ago

aurawindsurfing left a reply on Laravel Multilingual Routing And SEO

Hi @albertovalerio

I use arcanedev/localization for my localized routing

Apart from the routes you also need to provide metadata for all you locales like so:

<meta property="og:locale"content="{{ app()->getLocale() }}" />
@foreach(localization()->getSupportedLocales() as $key => $locale)
    <meta property="og:locale:alternate"content="{{ $key }}" />
@endforeach

then also in your sitemap (I use spatie/laravel-sitemap)

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

Hope it helps!

aurawindsurfing left a reply on Loadbalancer With Forge Redirect Problems

Usually, too many redirects is caused by invalid https setup. Did you set up your ssl? As far I remember it should be set on LB and not on workers.

Hope it helps!

18 Jul
4 days ago

aurawindsurfing left a reply on Redirect After Download.

Mark the question as solved, please.

aurawindsurfing left a reply on Nova, How To Save Product Features In Separate Table?

Oh wait it does! It is called MorphMany ?

aurawindsurfing left a reply on What Is The Advantage Of Using Closures In Factories?

The advantage is that in clousure you are able to associate relationship straight away between parent and closure models.

aurawindsurfing left a reply on Nova, How To Save Product Features In Separate Table?

Hi @kgp43

Just go back to your app and change the way you handle models. Make product model and product_features model and reflect them in Nova.

This would be the way to go in my opinion.

Hope it helps!

aurawindsurfing commented on Prepping The Frontend

The easiest way these days is to just use Tailwindcss Preset available here: https://github.com/laravel-frontend-presets/tailwindcss you can skip most of this lesson then.

aurawindsurfing left a reply on Saving Errors To DB / Custom Error Messages

Hi @cservices

Ok so to break your question in 2 separate ones:

I want to log to the database error messages created by specific methods.

To do this you would have to create a custom driver. As you can see however it is not a very popular solution judging by a number of stars on this package. Why would you not want what everyone else uses to log errors eg. files?

https://github.com/danielme85/laravel-log-to-db https://laravel.com/docs/master/logging#introduction

I also want to display a custom message to the user and refer them back to a specific page once they acknowledge the error.

What you are talking about here is handling exceptions (errors) what normally happens is you get a standard laravel 403 page or something, but you might customise all of it and on the page, you design ask you ser for acknowledgement and redirect back. Here is a nice tutorial on how to handle the exceptions

https://laraveldaily.com/how-to-catch-handle-create-laravel-exceptions/

Hope it helps!

aurawindsurfing left a reply on Redirect After Download.

Hi @julimen5

This will not work. Your browser operates on simple requests one goes out one comes in.

There is no way for browser to know if user finished downloading the file and saved it somewhere. The final response from browser if file to be downloaded, nothing can follow that as far as I understand.

Now I'm not sure how that can be handled in javascript but in pure html requests it will not work.

Hope it helps!

aurawindsurfing left a reply on Composer Requirements Conflict

@afghany

What version of PHP are you on?

What version of Laravel?

Show your composer.json file

Show your error.

17 Jul
5 days ago

aurawindsurfing left a reply on Access Admin Form Without Login

You can store whatever you want in a session.

aurawindsurfing left a reply on Composer Requirements Conflict

Hi @afghany

No they do not have a conflict.

Here is a brand new laravel install:

 ~/Sites  cd test                                                                                           PHP 7.2.15
  ~/Sites/test  composer require maatwebsite/excel                                                  5.8.29  PHP 7.2.15
Using version ^3.1 for maatwebsite/excel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
  - Installing markbaker/matrix (1.1.4): Loading from cache
  - Installing markbaker/complex (1.4.7): Downloading (100%)         
  - Installing phpoffice/phpspreadsheet (1.8.2): Loading from cache
  - Installing maatwebsite/excel (3.1.14): Loading from cache
phpoffice/phpspreadsheet suggests installing mpdf/mpdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing tecnickcom/tcpdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for rendering charts, or including charts with PDF or HTML Writers)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: maatwebsite/excel
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
  ~/Sites/test  composer require laravel/passport                                                   5.8.29  PHP 7.2.15
Using version ^7.3 for laravel/passport
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 15 installs, 0 updates, 0 removals
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing psr/http-factory (1.0.1): Loading from cache
  - Installing zendframework/zend-diactoros (2.1.3): Downloading (100%)         
  - Installing symfony/psr-http-message-bridge (v1.2.0): Loading from cache
  - Installing phpseclib/phpseclib (2.0.21): Downloading (100%)         
  - Installing defuse/php-encryption (v2.2.1): Downloading (100%)         
  - Installing lcobucci/jwt (3.3.1): Loading from cache
  - Installing league/event (2.2.0): Downloading (100%)         
  - Installing league/oauth2-server (7.4.0): Downloading (100%)         
  - Installing ralouphie/getallheaders (3.0.3): Loading from cache
  - Installing guzzlehttp/psr7 (1.6.1): Loading from cache
  - Installing guzzlehttp/promises (v1.3.1): Loading from cache
  - Installing guzzlehttp/guzzle (6.3.3): Loading from cache
  - Installing firebase/php-jwt (v5.0.0): Downloading (100%)         
  - Installing laravel/passport (v7.3.2): Downloading (100%)         
symfony/psr-http-message-bridge suggests installing nyholm/psr7 (For a super lightweight PSR-7/17 implementation)
phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.)
phpseclib/phpseclib suggests installing ext-mcrypt (Install the Mcrypt extension in order to speed up a few other cryptographic operations.)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: fideloper/proxy
Discovered Package: laravel/passport
Discovered Package: laravel/tinker
Discovered Package: maatwebsite/excel
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.

aurawindsurfing left a reply on Send Mail With Fake Data

Hi @plasmic

Try to persist model first and then pass it to the queue. I had similar issue when I thought if I chain the commands the model passed to the second and third will be the updated one, but that was not the case. You would have to persist it to the DB and retrive in in the queue.

Hope it helps!

aurawindsurfing started a new conversation Your Rocket ? League Ids

Ok anyone out there playing Rocket League? What are your handles? Mine is

unb_irish

How about yours?

aurawindsurfing left a reply on Laravel Nova Multiple Database Connection Problem

Hi @

This has nothing to do with Nova. You should simply create your models while one model will be using One database and then other model will be using another database connection.

https://laravel.com/docs/master/eloquent#introduction

By default, all Eloquent models will use the default database connection configured for your application. If you would like to specify a different connection for the model, use the $connection property:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
    /**
     * The connection name for the model.
     *
     * @var string
     */
    protected $connection = 'connection-name';
}

Now how this will work with relationships, I have no idea but in theory given how well Laravel works you should be able to create it.

Give it a shot!

aurawindsurfing left a reply on Wildcard Subdomains Point To New Laravel Apps With Forge Setup

Here is a good read how you can implement that: https://ollieread.com/blog/2018/08/06/laravel-multi-tenancy-avoiding-over-engineering

I still think however that multi-site is bit over the top solution. What Taylor does on Forge is simply using tenant_id on every table in your app. This is it. Nothing too complicated in there.

Happy coding!

aurawindsurfing left a reply on Access Admin Form Without Login

Hey,

Always try to code yourself, it helps! ?

Ok so what you would do is just to amend the flow in your app. At the moment the form is within routes that are protected by ->auth() authorization, so user has to authorize to access them.

If you move your [email protected] route outside then the authorization will not be required.

You can then handle the form just like in a normal situation. Once the form is filled in put all your form data into session: https://laravel.com/docs/master/session#storing-data

Then redirect your user to authorization and when he is back submit the form, or do it in whatever order you like. You can even submit it straight away and only make it valid when user that created it has an active account.

You to you really.

Hope it helps!

aurawindsurfing left a reply on CRUD Vue.js Components Showing Blank Screen With Laravel

<your-component-name></your-component-name>
16 Jul
6 days ago

aurawindsurfing left a reply on CRUD Vue.js Components Showing Blank Screen With Laravel

Yes start with index component and then within index refer to to whatever component you need.

aurawindsurfing left a reply on CRUD Vue.js Components Showing Blank Screen With Laravel

Hi @radko

I think the problem is here:

<example-component></example-component>

As far as I can see you have no such component, instead you have index component and other components as well. Try replacing this line with one of the components names in the same fashion. It should help.

Good luck!

aurawindsurfing left a reply on Homestead / Composer Issues

Looks like you might have installed composer locally and therefore it does not have sufficient permissions. Do you run it from within homestead? Or from your machine?

15 Jul
1 week ago

aurawindsurfing left a reply on SSL Issue On Fresh Laravel Install

Maybe just disable it for local developement?

aurawindsurfing left a reply on Testing Registration

Hi @wyatt44

'email' => '[email protected]' is a valid email address.

That is why it fails. Try to pass an empty email.