cosminc

cosminc

Member Since 3 Years Ago

Experience Points 20,700
Experience
Level
Lessons Completed 229
Lessons
Completed
Best Reply Awards 0
Best Answer
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 Nov
4 days ago

cosminc left a reply on Sending Queued E-mails

Thank you for your input, @martinbean.

cosminc started a new conversation Sending Queued E-mails

Hello everybody!

So I'm working on a newsletter application and I'm in doubt about the implementation of sending the e-mails via a queue.

What should be my approach in this case: should I create a job to fetch all the e-mail addresses and then send the newsletter to each one or should I use the queue() method of the Mail facade?

Thanks.

06 Nov
2 weeks ago

cosminc left a reply on Password Resets Using Encrypted E-mail Addresses

@Snapey, can you help me with an example of how can I use the trait you wrote in order to make the password recovery work?

22 Oct
4 weeks ago

cosminc left a reply on Password Resets Using Encrypted E-mail Addresses

@Snapey, I understand you solution and I want to thank you for writing it. The problem is I don't know how to implement it within the password reset mechanism.

cosminc left a reply on Password Resets Using Encrypted E-mail Addresses

So this endeavour is for nothing. In the end, it won't work.

21 Oct
4 weeks ago

cosminc left a reply on Password Resets Using Encrypted E-mail Addresses

@D9705996 seems to work fine for saving, but it doesn't for the login / password reset.

cosminc left a reply on Password Resets Using Encrypted E-mail Addresses

Here's my output for dd($request->toArray());:

array:5 [▼
  "_token" => "vqJFnI2w1yk45uql2smWQxoCsjiPG824JVlbBcu6"
  "name" => "Foo"
  "email" => "[email protected]"
  "password" => "123456"
  "password_confirmation" => "123456"
]

cosminc left a reply on Password Resets Using Encrypted E-mail Addresses

I tried that already, but upon register I get this error:

"SQLSTATE[HY000]: General error: 1364 Field 'email' doesn't have a default value (SQL: insert into users (name, password, updated_at, created_at) values (John Doe, $2y$10$qF7izTPH6svQUubPPnvmF.ikv7534QrJJrrDJVk3AlMoKFGmQ1Qxy, 2018-10-21 18:15:02, 2018-10-21 18:15:02))

cosminc started a new conversation Password Resets Using Encrypted E-mail Addresses

Hi everybody,

For the application that I'm currently working on I need to have the e-mail field in the "users" table in an encrypted form.

I'm using the methods available through the Crypt facade and it works fine for registration.

The problem is that I don't know where I should modify the code in order to achieve the same functionality for password resets.

Basically I need to tell Laravel to first encrypt the e-mail that the user has provided via the password reset form and then search for it in the "users" table.

11 Oct
1 month ago

cosminc left a reply on Fetch Error Message Generated By File Upload Validator

This is the output when only the input field is invalid:

ViewErrorBag {#561 ▼
  #bags: array:1 [▼
    "default" => MessageBag {#552 ▼
      #messages: array:1 [▼
        "attachment" => array:2 [▼
          0 => "The attachment may not be greater than 1024 kilobytes."
          1 => "The attachment must be a file of type: jpeg, gif, png."
        ]
      ]
      #format: ":message"
    }
  ]
}

cosminc left a reply on Fetch Error Message Generated By File Upload Validator

Here goes:

$validatedData = $request->validate([
    'firstname' => 'required|max:32|regex:/^[. a-zA-Z0-9_-]+$/',
        'lastname' => 'required|max:32|regex:/^[. a-zA-Z0-9_-]+$/',
        'email' => 'required|email',
        'message' => 'required|max:1000',
     'captcha' => 'required|captcha',
     'attachment' => 'file|max:1024'
]);

cosminc started a new conversation Fetch Error Message Generated By File Upload Validator

Hello everybody,

I'm building a form with multiple fields and among those I also have a file upload input.

I'm trying to display an error message after each input, but it seems that this logic doesn't work for the file upload one.

<div class="form-group">
    <label for="attachment">Attachment</label>
    <input id="attachment" type="file" class="form-control" name="attachment">
</div>

@if ($errors->has('attachment'))
    <span class="error">
        <strong>{{ $errors->first('attachment') }}</strong>
    </span>
@endif 

It seems that I can only get the error from the input field with a code like this:

@if ($errors->any())
    @foreach ($errors->all() as $error)
        <div class="alert alert-danger" role="alert">
            {{ $error }}
        </div>
    @endforeach
@endif 

So my question is: what do I need to do in order to fetch the error for that specific field?

Thank you.

25 Aug
2 months ago

cosminc left a reply on Set A Default Per Page In A Query Unless The User Has Selected A Per Page Limit

Ah, so simple! :) Didn't thought of that. Thanks.

cosminc started a new conversation Set A Default Per Page In A Query Unless The User Has Selected A Per Page Limit

Hello,

I would like to be able to specify a default number of results per page unless the user has selected a value for this.

The problem is that I don't know how to fetch the results if I use an if/else statement for the "per_page" input element.

Here's what I have so far.

Any help is appreciated.


public function index(Request $request)
{
    $query = (new User)->newQuery();

    // Search for an user
    if ($request->has('search'))
    {
        $query->where('name', 'like', '%' . $request->input('search') . '%')->orWhere('description', 'like', '%' . $request->input('search') . '%')->orWhere('uuid', 'like', '%' . $request->input('search') . '%');
    }

    // Order results
    if ($request->has('order_by'))
    {
        $query->orderBy($request->input('order_by') , $request->input('order_direction'));
    }

    // Set the number of results per page
    if ($request->has('per_page'))
    {
        $query->paginate($request->input('per_page'));
    } else {
        $query->paginate(20);
    }

    $users = $query::get();

    return view('users.index', compact('users'));
}
23 Aug
2 months ago

cosminc left a reply on Find An Optimal Method For Checking If Data Exists While Importing Thousands Of Rows From A CSV File

I was thinking more of an Eloquent/Query Builder approach.

cosminc started a new conversation Find An Optimal Method For Checking If Data Exists While Importing Thousands Of Rows From A CSV File

Hello,

I'm importing e-mail addresses from a CSV file. I need to check for each address if it already exists in the database and if not, I should save it.

The problem is that the CSV generally contains thousands of e-mail and I find it highly inefficient to run as many SQL queries while importing.

What other options do I have?

19 Aug
3 months ago

cosminc left a reply on Best Practice For Naming Your Sub Folders In The "views" Folder

Thanks!

I will go for "mailing_list".

Regarding what jirdw said about compound view names, I would have chosen "list" for the model/controller/view but I thought that it might conflict with other reserved words. Maybe I'm wrong, I don't know :)

18 Aug
3 months ago

cosminc started a new conversation Best Practice For Naming Your Sub Folders In The "views" Folder

Hello everybody!

From a best practice point of view, what whould be the best way to name your folders in the "views" directory when you're referring to a module that has two words in its name.

For example, if I have the "MailingList" model and "MailingListController", the best way to name the views directory would be "mailing.list" or "mailing_list" or "mailingList" ?

Thanks.