cuartas15

cuartas15

Member Since 2 Months Ago

Experience Points
690
Total
Experience

4,310 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
0
Lessons
Completed
Best Reply Awards
0
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.

Level 1
690 XP
Jan
15
1 week ago
Activity icon

Replied to CSRF Token Mismatch When Working On 2 Different Routes At The Same Time

correct me if I'm wrong, but not really? because caffeine is just looking to keep the session opened, remember the token is set either in the form html or the javascript boostrap file (for AJAX calls and such), that validation is what is failing, so basically there needs to be a way to update the token client-side when it changes server-side due to the log in, right?

In my particular case is a problem, my site is a system to make medical appointments, the patients sometimes get lost in the process so they call the medic in charge (or their secretary), they are logged in at that point, so they open the page to make appointments to run the patients through the process and that's where they can randomly face this issue

Activity icon

Replied to CSRF Token Mismatch When Working On 2 Different Routes At The Same Time

Hmm, then I wonder how can I fix that, because it would be weird to tell people not to log in when they also are navigating the "visitor" pages, people will hardly figure out they need to refresh the page so that'll end up in an unnecessary support ticket

Jan
14
1 week ago
Activity icon

Replied to CSRF Token Mismatch When Working On 2 Different Routes At The Same Time

Expired after 2 minutes? because that's how it is honestly.

Jan
13
1 week ago
Activity icon

Started a new Conversation CSRF Token Mismatch When Working On 2 Different Routes At The Same Time

I have 2 routes for 2 different pages, one is the user panel that requires to be authenticated to do anything (pure AJAX/Axios calls, Laravel Websockets with Echo and such) then there's the other page, free for anyone, it also has some operations with AJAX but of course it doesn't go through the auth middleware.

What happens is that if an user is logged and also visits the "visitor" page so to speak in a new window/tab, at some random point (literally random, there's no pattern that causes this) one of the 2 pages stop doing successful requests due to an Error 419: CSRF Token Mismatch and the user is forced to refresh the page in order to get it working once again, I would assume there's a conflict produced when one page loads after the other and replaces the token contained for the first page? shouldn't both pages have the same token all the time in the same browser? if not, how do I fix this?

Thanks in advance.

Jan
01
3 weeks ago
Activity icon

Started a new Conversation How To Send A Notification Email To Non-stored Emails In Bulk?

I know you can send a notification in bulk using the Notification facade like so:

Notification::send($users, new InvoicePaid($invoice));

but it requires a collection of a model which contains the Notifiable trait and cannot just receive an array of emails or something like that.

I also know you can use something like:

Notification::route('mail', '[email protected]')

To send an email to a mail that is not stored in any of our models. I might've thought I can use Notification::route because route can be called multiple times, but I'm not sure if I can use the 'mail' route configuration more than once or the proper way to construct the notification, I've been testing:

$notification = Notification::route('mail', $mailList[0]);
for ($i = 1; $i < count($mailList); $i++) {
    $notification->route('mail', $mailList[0]);
}
$notification->notify(new notificationMessage);

and it just sends it to the latest route set in the for, so it's just overwritting one over another.

Also, I should consider sending the mails with BCC in mind. is there a way to do this other than calling Notification over an over for each email passed to the array? doing it this way will hit performance one way or another?

Thanks in advance

Activity icon

Replied to Required_if Not Working As Intended With Other Rules?

Ok, so the solution.

'email_list' => ['bail', 'required_if:this_office,0', 'nullable', 'array'],

This guaranteed me to show the messages where they're actually needed, don't ask me why

jlrdw please pay attention to the screenshot I sent, it is coming as a 0 or a 1, maybe you're confused because you think I'm using the default form submit, no, I'm using Ajax via Axios.

Dec
31
3 weeks ago
Activity icon

Replied to Required_if Not Working As Intended With Other Rules?

Not a checkbox, 2 radio buttons and like I said, this is what I get on the request, you can see this in telescope:

https://i.gyazo.com/d32c1226ea2c7da3c1835f8eac810527.png

Even changed the 0,1 to a yes and no and yet still I'm getting the same result

Activity icon

Started a new Conversation Required_if Not Working As Intended With Other Rules?

No matter what I throw to the first field, required_if will not even validate the field and will even start validating the next rules

$request->validate([
          'this_office' => ['bail', 'required', 'in:0,1'],
          'email_list' => ['bail', 'required_if:this_office,0', 'array'],
    ],

so in this case, I'm sending:

"this_office": 0,
"email_list": null,

And I'm not getting the required_if message but the array one, why?

Also, if "this_office" is 1 or no matter what number, "email_list" will still validate against array.

Is there a way to fix this? I'm using the latest Laravel version.

Thanks in advance

Dec
18
1 month ago
Activity icon

Replied to Upgrading From 5.8 To 6.7.2 Made Eloquent Union Function To Cast An Integer To A String

Just an update, $casts did nothing, even on columns I wanted to purposedly cast to string.

my forge server also has mysqlnd

EDIT: finally fixed this issue, in my DB::raw had to do a mysql cast fo unsigned like so:

// from
DB::raw('null as appointment_id')
// to
DB::raw('cast(null as unsigned) as appointment_id')
Activity icon

Replied to Upgrading From 5.8 To 6.7.2 Made Eloquent Union Function To Cast An Integer To A String

Ok, I'm gonna try 2 things then in a couple hours:

  • I'm going to take the sql query generated by telescope and paste it on phpmyadmin and then see if I get exactly the same result
  • I'll use protected $casts on my Revision model and see if that makes any difference
Dec
15
1 month ago
Activity icon

Replied to Upgrading From 5.8 To 6.7.2 Made Eloquent Union Function To Cast An Integer To A String

Alright, I've found the issue, and it's not something I would've thought.

This behaviour is happening with Laravel 5.8 and php 7.1.2 as well, appointment_id is coming with a string value instead of an integer.

Thing is, I've never encountered this issue because I was never doing operations with this data specifically, now I added a new feature to my application client side (javascript/vue) where the data type is essential since I'm using the === operator, and of course this will fail. As a workaround I'm using == but this is far from ideal, I think I found a bug in the framework maybe?

Activity icon

Replied to How To Change The Email Configuration For Laravel Notifications On The Fly?

Yeah, that'll do the trick, but I have a question, what if there's more than one operation of sending an email at the same time? am I directly messing with the .env file by doing this? is this gonna affect other notifications that need the default configuration instead of the one modified on runtime?

Dec
14
1 month ago
Activity icon

Replied to Upgrading From 5.8 To 6.7.2 Made Eloquent Union Function To Cast An Integer To A String

afaik that's a linux command, I'm using windows 10 and using xampp for database, wouldn't just mysqlnd be enabled by default?

Installation on Windows

In the official PHP Windows distributions from 5.3 onwards, MySQL Native Driver is enabled by default, so no additional configuration is required to use it. All MySQL database extensions will use MySQL Native Driver in this case.

And anyways, phpinfo is reporting mysqlnd 5.0.12-dev - 20150407 as the Client API library version

I don't think that's the issue honestly

Activity icon

Started a new Conversation Upgrading From 5.8 To 6.7.2 Made Eloquent Union Function To Cast An Integer To A String

I ugraded my app's laravel version to the latest (among other composer dependencies, including php from 7.1.2 to 7.2) and now union is doing some weird stuff with my data:

    $appointmentList = Appointment::select('id', DB::raw('null as appointment_id'), 'office_id', 'patient_id', 'date', 'time', 'minutes', 'selected_entity', 'available', 'locked', 'active', 'description', DB::raw('1 as isAppointment'))
        ->with('patient')
        ->with('appointmentsEntities')
        ->where('office_id', auth()->user()->office_id)
        ->where('date', $formatDate->toDateString())
        ->where('active', '1');

    $revisionList = Revision::select('id', 'appointment_id', 'office_id', 'patient_id', 'date', 'time', 'minutes', 'selected_entity', 'available', 'locked', 'active', 'description', DB::raw('0 as isAppointment'))
        ->with('patient')
        ->where('office_id', auth()->user()->office_id)
        ->where('date', $formatDate->toDateString())
        ->where('active', '1');

    $appointmentRevisionList = $appointmentList->union($revisionList)
        ->orderBy('time')
        ->get();

        \Log::info($appointmentRevisionList);

    return Response::json([
        'success' => true,
        'data' => $appointmentRevisionList,
    ], 200);
}

note the Log line, that is giving me a string instead of an int in appointment_id (which is a BIGINT on MySql) if I just log this:

\Log::info($revisionList->get());

Now it gives me the correct data type. So basically the combination of union and apparently setting the value to null on $appointmentList is giving me this weird behaviour after I upgraded to laravel 6.7.2. I completely discard the PHP upgrade because my current DO production server is already using PHP 7.3, but it's still using 5.8 for Laravel. This is happening as of right now, on my local environment.

I want to know how to fix this honestly.

Thank you.

Activity icon

Started a new Conversation How To Change The Email Configuration For Laravel Notifications On The Fly?

I'm using Laravel email notifications to send my emails because that's enough for my needs.

Now, I need to use a new email configuration for a specific type of email I pretend to send, so the mailgun config I have on my .env file cannot be used, I've found guides but using mailable directly, I sill wanna keep using notifications for consistency.

This is basically the layout for each type of message I'm sending throughout my application:

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class SmeClientMailContact extends Notification
{
    use Queueable;

    /**
     * Create a notification instance.
     *
     * @param  string  $message
     * @param  string  $email
     * @param  string  $phone
     * @param  string  $contactName
     * @return void
     */
    public function __construct($message, $email, $phone, $contactName)
    {
        $this->message = $message;
        $this->email = $email;
        $this->phone = $phone;
        $this->contactName = $contactName;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->from(config('app.contact_email'), config('app.contact_email_name'))
            ->subject('Su Médico Especialista - Mensaje de contacto de ' . $this->contactName)
            ->greeting('Mensaje de contacto de ' . $this->contactName)
            ->line('Este cliente acaba de enviar un correo de contacto a sumedicoespecialista.')
            ->line('Nombre: ' . $this->contactName)
            ->line('Correo electrónico: ' . $this->email)
            ->line('Teléfono: ' . $this->phone)
            ->line('Mensaje: ' . $this->message);
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

What's the way to manually set the mail driver, host, port, etc for this notification specifically for example.

Thanks in advance

Dec
03
1 month ago
Activity icon

Replied to Scalability On Demand?

Anyone have a possible answer? I honestly refuse to believe that the only way is setting the load balancers and such from minute 0 because that would be a good waste of money. I of course gave a look to vapor, but it requires laravel 6+ and it costs triple the Most basic plan on forge and double the one that allows multiple sites. Remember I'm making these questions with saving money in mind.

Thanks in advance

Dec
02
1 month ago
Activity icon

Replied to Scalability On Demand?

Uhh, my app is off the mark by 1 version (5.8) and why would I need to switch to Vapor when I can achieve the same with Forge, right?

Activity icon

Started a new Conversation Scalability On Demand?

I've been through multiple tutorials, where the scalability basically begins since the application is first deployed by configuring load balancers and some guides go as far as making a separate server for each individual function (database, redis, application, etc) which is excessive cost wise honestly.

What if I configure a DO server that is simply enough for a year or two, I have everything there, my application, database, Laravel websockets and then when the time comes I need to assign more resources, how do I proceed in that case? would I need to start from zero to decouple my sever into multiple instances each one doing something different or is there a more simpler approach? what if I just need to allocate more storage? are there any good tutorials explaining these situations?

Any help is really appreciated.

Nov
17
2 months ago
Activity icon

Replied to Questions About Mass Email With Scheduler

That's an insteresting approach, but I tried that and then I put my site url in APP_URL and yet still the logo isn't showing up, giving me exactly the same html structure when I inspect it

Activity icon

Replied to Questions About Mass Email With Scheduler

Hmm, that's an issue this is what I have:

APP_URL="/"
APP_EXT_URL=""
APP_EXT_URL_LINK="http://mydomain.com/"

The issue is if I put my url on APP_URL it messes with basically almost everything that is out there in the web page that is made to go back to the root page, that's why I added APP_EXT_URL and APP_EXT_URL_LINK, to not mess with these other functions.

Just to put it into context: I use APP_EXT_URL for the action button of all my emails that are not coming from my scheduler like so:

->action('Publicar Valoración', url(config('app.exturl') . route('review.confirm', $this->token, false)))

If I just use APP_URL the action will have a totally incorrect url, basically pointing to localhost

APP_EXT_URL_LINK is specific for the mail sent via scheduler and I have to use it like this:

->action('Visitar perfil del especialista', url(config('app.exturllink') . 'p/' . $this->module_title))

It is also being used for the href in my message's template logo.

So yeah, I don't know what exactly I am doing wrong but for now I came up with these workarounds to get it working in all these different situations

Activity icon

Replied to Questions About Mass Email With Scheduler

Ok so this was actually a mistake from my part, my MAILGUN_DOMAIN and MAILGUN_SECRET were missing in my env file, once I put them with the correct information I finally got emails from the right domain

Activity icon

Replied to Questions About Mass Email With Scheduler

Alright, I'm gonna try that out later, for now I configured a mailgun account and I'm going for the most basic setup for now that is using the smtp config instead of the API or the lib you provided, changed my env file, restarted the server and for some reason my app is still sending emails through my old configuration (meaning old domain vs a new domain name that I used for mailgun specifically).

Do I need to clear some cache or something?

Activity icon

Replied to Questions About Mass Email With Scheduler

Nada, I don't think anything wants to work for me in the foreseeable future, perhaps I will have to live with the fact that only single email is coming without logo

Activity icon

Replied to Questions About Mass Email With Scheduler

hmm, this is weird, Telescope is not giving me any logs about it, I just added this to the blade template, it works in local but not in production

@php
    \Log::info(url('images/sme_logo.png'));
    \Log::info(asset('images/sme_logo.png'));
@endphp
Activity icon

Replied to Questions About Mass Email With Scheduler

Same result unfortunately. Something has to be happening with a mail being sent via scheduler

Activity icon

Replied to Questions About Mass Email With Scheduler

Uhhh... I don't think making a preview will be an easy task because I don't really save any email content and my emails are notifications and not just mailables per se? I can show you what I see in my email though.

Password reset: https://i.gyazo.com/f297d5dfd7548b847972d37ebf3da2d5.png

Appointment notification via scheduler: https://i.gyazo.com/6ff4b30fc463734b07d664d96a96fa25.png

Like I said, all my emails are based on MailMessage from the default Laravel notifications boilerplate

Nov
16
2 months ago
Activity icon

Started a new Conversation Questions About Mass Email With Scheduler

I have 2 specific questions about email in production:

  • Since I'm a total novice on this, I finally got to configure a site on Laravel Forge properly, I can send emails via cron job using the php artisan schedule:run, but I've come to realize this won't work by just using Private Email provided by Namecheap as an email service.

The domain I'm using on my site is stored in Namecheap so I thought using and configuring an email there too would be easy and convenient, I paid for the [email protected], created a bunch of aliases and included them in my application to send emails, and it works, but the email service only allows 500 mails per hour.

I'm not looking to send mass emails as marketing or email lists (for now), what my app is doing is: Use a job to retrieve a list of appointments assigned to the next day in order to send a reminder to the clients, so each email is unique because it has an individual client name/appointment date/time and meeting address. What I've been using to achieve this is Laravel notification, the one that comes with it but slightly modified (I just changed the markdown a little bit).

The amount of appointments per day can go up to hundreds of thousands in the future so I need a service that can do that for me without worrying about email limits and blacklisted ips.

Not to mention I'm using the same notification system for password resets, appointment cancelations, contact and other functions.

So I'm looking for something that can cover these needs, I've been looking mailgun, mailchimp, etc but all of these are oriented on Marketing? and like I said I don't really want that for now but something that can allow me to send massive amounts of mails at once and at the same time individual messages as well? maybe since I know nothing about this I think those services aren't for me but they actually are? that's why I need help about it.

  • This question is more related to Laravel, in production, when I send emails with the scheduler, that email isn't coming with a small image logo but just the alt text, when I inspect it, it's sending something with a localhost route for some reason, this is just for this specific case of sending notifications via jobs, if I for example send a password reset email, the image is showing up just fine, is there something I have to do diferently about it?

This is what my blade template looks like:

@component('mail::layout')
    {{-- Header --}}
    @slot('header')
        @component('mail::header', ['url' => config('app.exturllink')])
            <img src='{{ asset('images/sme_logo.png') }}' height='70' alt='{{ config('app.subname') }}'>
        @endcomponent
    @endslot
    {{-- ... --}}
Nov
14
2 months ago
Activity icon

Replied to Either Changing The Meta Or Installing A SSL Certificate Has Broken My Site

So I solved the issue by basically starting almost from zero. Ended up removing the SSL certificate, went to default and then back to my domain name in Meta, removed the repository and re-installed it once again then reran my deployment script with a fresh database and composer/npm packages, before installing the SSL certificate I made sure it was working with http at least, it was so I went with the installation and now it's working. I don't really know how or why but that's what happened.

Activity icon

Replied to Either Changing The Meta Or Installing A SSL Certificate Has Broken My Site

I ran both commands in my project's root folder, didn't get any output and unfortunately that didn't fix it either.

Activity icon

Started a new Conversation Either Changing The Meta Or Installing A SSL Certificate Has Broken My Site

So, following the laracasts videos I changed my default site's meta to my domain and then installed a Let's Encrypt certificate, tried browsing my site and I just get an empty screen and a 500 error in the browser's console. I tried redeploying my aplication since maybe the change in directory was the cause but still nothing.

Checking nginx logs this is the full error stack I'm getting:

https://i.gyazo.com/5326e10a3a6e8caa3954b72f0044a059.png

Any help would be appreciated.

Nov
13
2 months ago
Activity icon

Replied to Laravel-Echo-Server Installation On Forge With SSL Enabled With The Redis Broadcast Driver And Socket.io

I'm testing this guide with http at the moment, I got to the point where I need to create the daemon but I think it's not working for me, I'm getting this message:

https://i.gyazo.com/3122a0d57bfa08fbd4ed9f2e9303c5a9.png

have in mind my site is still the default, maybe that changes something in the paths?

Activity icon

Replied to Can't Install Dependencies Globally

Yes sir, that does the trick, thank you so much

Nov
12
2 months ago
Activity icon

Started a new Conversation Can't Install Dependencies Globally

First of all I'm a total noob on server deployment and anything related so bear with me. Second, I'm not so sure if this is more a Forge or a Digital Ocean issue. I've gotten to the point where my application is deployed, it has it's own domain, the database is fine, composer and npm dependencies are in place, etc. I'm getting to the step of configuring Redis + Socket.io + Laravel Echo Server for broadcasting but it seems I'm not able to install Echo (npm install -g laravel-echo-server) due to missing permissions.

https://i.gyazo.com/2e370242f55a38815252195c206c015b.png

I've tried to change the folder permissions to even 777 but I get to another permission roadblocks down the line.

For the record, npm install (without the -g) is working perfectly to install my project's dependencies

I would appreciate any help on the matter.

Thanks in advance