Chron

Chron

Member Since 5 Months Ago

Experience Points 5,300
Experience Level 2

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

15 Jun
2 days ago

Chron started a new conversation How Can I Use Php Function Inside Vue?

function authCss(){
    if (Auth::check()) {
        switch (Auth::user()->account_type) {
            case 'Admin':
            return 'huntergreen';
            break;
            case 'Customer':
            return 'forestgreen';
            break;
            default 'Low-end':
            return 'balticsea';
            break;
<button type="submit" class="btn btn-{{authCss()}}">

I've tried this, it worked as expected while I was just using laravel but when I added vue.js this happened.

07 Jun
1 week ago

Chron started a new conversation Are There Any Differences With Redirects?

return redirect('/');
return redirect()->route('home');
return redirect()->intended('/');
return back();

Are there any differences with these four?

Chron left a reply on Problem With Validation

@JOHNBRAUN - how about validating all of it like this..

$validatedData = request()->validate([
    'email' => ['required', 'email'],
    'account_type' => ['required'],
    'firstname' => ['required'],
    'middlename' => ['required'],
    'customer_type' => ['required'],
]);

Then just call the field name if it was required? Because for eg. customer_type isn't a field needed unless you're registering a new customer, but there's more than two user types using the system. So if its another user other than customer..

$other_users = User::create([
    'other_columns' => $request->other_columns_that_customer_doesnt_have 
    ......
])


$customer = Customer::create([
    'customer_type' => $request->customer_type,
    .......
])


Chron left a reply on What Would Be The Validation For Password?

@CRONIX - @snapeOhh, I thought making the column nullable. Sorry for being dummy dumb dumb.

06 Jun
1 week ago

Chron left a reply on What Would Be The Validation For Password?

@SNAPEY - I think its not a good idea to make a password nullable

Chron left a reply on What Would Be The Validation For Password?

@YIBR - It returns true even if the password field is empty

05 Jun
1 week ago

Chron started a new conversation What Would Be The Validation For Password?

I think password isn't change very often, how can I update other fields without touching the password field if password field is empty is sometimes rule okay with this?

Chron left a reply on Problem With Validation

@JOHNBRAUN - Your code only hit the end of $validatedData

Chron left a reply on Problem With Validation

Would it work if it is like this?

//validation
$account = request()->validate([
    'email' => ['required', 'email'],
    'account_type' => ['required'],
]);

$info = request()->validate([
        'firstname' => ['required', 'min:2'],
        'middlename' => ['required', 'min:2'],
    ......
]);


//creates account and user if it was validated
if($account && $info) {
    Account::create($account)->customer()->create($info);
}

Chron left a reply on Select Inputs Ignored By Validation

@MTHOMAS - Still no errors getting outputted...Already imported use Illuminate\Validation\Rule;

'sex' => ['required',Rule::in(['Male,Female'])],

Chron started a new conversation Problem With Validation

I have this here:

$account = Account::create(request()->validate([
        'email' => ['required', 'email'],
        'account_type' => ['required'],
]));

$account->customer()->create(request()->validate([
    'firstname' => ['required', 'min:2'],
    'middlename' => ['required', 'min:2'],
]));

I tried it inline

Account::create(request()->validate([
        'email' => ['required', 'email'],
        'account_type' => ['required'],
]))->customer()->create(request()->validate([
    'firstname' => ['required', 'min:2'],
    'middlename' => ['required', 'min:2'],
]));

Yes, it validate the inputs. However, For example, I created an account in its own field (email and account_type), but I didn't input any data on the customer fields (firstname, middlename ..etc). The account is still created, I want it to abort the whole process if it failed to feed the required inputs.

Chron left a reply on Select Inputs Ignored By Validation

How can I add a field without validating it?

Account::create(request()->validate([
    'email' => ['required', 'email'],
    'account_type' => ['required'],
]));

Password is generated after the account and user are created. How can I input a data and at the same time validate other fields? Something like..

Account::create([
    'password' => 'password' //hardcoded because it will be changed after the account has been created.
],
request()->validate([
    'email' => ['required', 'email'],
    'account_type' => ['required'],
]));

Chron started a new conversation Select Inputs Ignored By Validation

How can I tell laravel to include select inputs in validation?

<div class="col-md-3">
    <div class="form-group">
        <label for="sex">Sex</label>
        <div class="input-group">
            <select name="sex" id="sex" class="form-control">
                <option selected disabled value="">Male or Female? </option>
                <option value="Male">Male</option>
                <option value="Female">Female</option>
            </select>
            @if ($errors->has('sex'))
                <span class="invalid-feedback" role="alert">
                    <strong>{{ $errors->first('sex') }}</strong>
                </span>
            @endif
        </div>
    </div>
</div>
$user = User::create(request()->validate([
    ...
    'sex' => ['required'],
]));

Chron started a new conversation Using Other Options Instead Of Id In Slug?

Is that possible? Like use the /projects/FirstnameLastname/edit of the user?

04 Jun
1 week ago

Chron left a reply on Route Model Binding Not Working

I saw a post regarding with this problem, the wildcard should match the route model in controller. So it should be...

Route::get('account/{account}/edit', '[email protected]');

Sorry for inconvenience

Chron started a new conversation Route Model Binding Not Working


Route::get('account/{id}/edit', '[email protected]');


public function edit(Account $account)
{
    return $account;
}

I'm only getting an empty array

03 Jun
2 weeks ago

Chron started a new conversation Select, Checkboxes And Radio

How can we fetch data to these form inputs?

I've tried this but it didn't worked:

<select name="sex" id="" class="form-control" value="{{ $value }}"> 
    <option value="...">...</option>
    <option value="...">...</option>
        ...
</select>

Chron started a new conversation What Web Browsers That Are Lightweight But Are Decent With Web Development?

I'm using linux and I've already tried qutebrowser and surf. They're great, however they have problems like js error etc. I'm currently using firefox. I would like to move to other browser because firefox is a bit laggy. I also tried Google Chrome and it's way heavier.

Chron left a reply on Form Action Redirects To A Blank Page

@JOHNBRAUN - the function already had a return value, can you return a returned value?

02 Jun
2 weeks ago

Chron left a reply on Form Action Redirects To A Blank Page

function store

public function store(Request $request)
{
    $account = Account::create([
            'email' => 'email',
            'password' => 'password',
        ]);
    create_admin($account);
}

create_admin function

function create_admin($account){
    $admin = $account->admin()->create([
        //data
    ]);
    return redirect('/account/create')->with('message', 'Admin created successfully!');
}

Chron started a new conversation Form Action Redirects To A Blank Page

I have these two:

Route::get('account/create', '[email protected]')->name('account.create');
Route::post('account/create', '[email protected]')->name('account.store');
<form method="POST" action="/account/create">
@csrf
    <div class="row">
    <div class="col-md-8">
        <div class="form-group">
            <label for="firstname">Firstname</label>
                <div class="input-group">
                    ......
                </div>
            </div>
        </div>
    </div>
</div>
</form>

Whenever I submit data, it gets redirected to /account/create but a blank page.

31 May
2 weeks ago

Chron started a new conversation Route [login] Not Defined

I've used auth()->logoutOtherDevices($password);

I tried it if it is working, and it is. However, when I refresh the page, I get the error. If I refresh it again, I get redirected to customer/login. I want it to redirect to / routes. How will I do that?

29 May
2 weeks ago

Chron left a reply on Passing Data To A View

@NAKOV - For example, I made an account,

$account = Account::create([
    'email' => request('email'),
    'password' => request('password')
]);

$infos = $account->customer()->create([
    'name' => request('name'),
    'age'=>request('age')
]);

$account->sendEmailVerificationNotification();
return redirect('/login');

How can I grab the $infos and put it to my email views where the layout for the email verification are?

Chron left a reply on Passing Data To A View

@NAKOV - >php artisan vendor:publish --tag=laravel-notifications

I have use that, it is in views/notifications/email. But I need to pass it to views/notifications/email while redirecting to another view.

Chron started a new conversation Passing Data To A View

How can I pass data to a view? To vendor.notifications.email specifically?

When I create an account it will be redirected to login form

$created=Customer::create($request->all());
if(account_is_created){
    return redirect()->intended('/dashboard')->with('status', 'message');
}

But how can I pass the created data to another view (to vendor.notifications.email) to use it for email markdown population?

Chron left a reply on E-Mail Verification On Register

Done did it! Using vendor:publish laravel-notification

Chron left a reply on E-Mail Verification On Register

@NAKOV - Can I create like a symbolic link where I can edit the view for the used email verification?

Chron started a new conversation E-Mail Verification On Register

When I'm logged in, then create a lower role account, by clicking register, I want that user to receive an email that he has been registered to my system.

I would like it to be like this..

if(I_am_logged_in()){ 
    //create an account for a user  
    Customer::create('
        'name' => request('name'),
        'email' => request('email'),
    ')->notify(new sendEmailVerification);
}

Can I do it like this?

Chron left a reply on How Can I Trigger Resources/lang/en/auth.php?

@NAKOV - Then I can access it with $errors->first('email')?

Chron left a reply on Validation

@NOMGUY - That may work. What if I want to grab the error and put it on a field? Like... If the user has wrong credentials, the error will be grabbed and put it on a variable like flashing.

So that I can make:

$errors->first('credentials') 

Like making return back()->with('status', 'You logged in') but instead of putting it in a session, it will be put to error.

Chron left a reply on Validation

@RAJDIPBACANCY - >I've made a request that has a rule in it

It is a rule request. It will be called whenever I make a request. In this case, I made a request when I'm logging in:

>request()->validate(['email','password']);

This automatically grabs the requests from the user and runs the request rule that I made.

Chron left a reply on Validation

@RAJDIPBACANCY - If the user input exists in the database, if not flash a message that says it doesn't exists. Something like that.

Chron left a reply on How Can I Trigger Resources/lang/en/auth.php?

@NAKOV - I have that already, I'm trying to filter the user inputs. Does Auth::attempt filters inputs?

Chron left a reply on Validation

@RAJDIPBACANCY - But that doesn't filter the user inputs.

Chron started a new conversation Validation

I've made a request that has a rule in it

public function rules(){
        return ['email' => 'exists:accounts'];
}
public function messages() {        
        return ['email.exists' => 'Email not found in our database'];
}

But whenever I made an attempt to authenticate the user


$filtered = request()->validate(['email','password']);
if(Auth::attempt($filtered)) {
    //go to this page
}

I get a false response, and how do I make a validation that if the data that has been inputted should have the value of a specific data in the database or else it will not get logged in?

Chron left a reply on How Can I Trigger Resources/lang/en/auth.php?

I'm talking about the "'failed' => 'These credentials do not match our records.'," in resources/lang/en/auth.php How can it be triggered in a controller?

I'm thinking like this:

'email' => 'unique:users|email|failed'
28 May
2 weeks ago

Chron started a new conversation How Can I Trigger Resources/lang/en/auth.php?

When the user inputs wrong credentials, auth.failed should be triggered but how can I grab that and make it like the login system that laravel ships with when we input wrong credentials?

13 May
1 month ago

Chron started a new conversation Frontend Email Verification?

Where are the views, markdowns of the built in email verification? Can I just vendor:publish them?

Chron left a reply on SendEmailVerificationNotification To A Dynamic Email

Here's my logic.

The 1st user creates another user, so if the 1st user inputs email, for example, '[email protected]', the user that owns that email will get an email verification to use the app.

Chron left a reply on SendEmailVerificationNotification To A Dynamic Email

@BOBBYBOUWMANN - I have use Notifiable on my App\Account,

 $account = Account::create([
            'email' => $request['email'],
            'password' => 'password',
]);

So its $account->notify(new Notifications\VerifyEmail);?

Chron started a new conversation SendEmailVerificationNotification To A Dynamic Email

For example, admin makes an account for [email protected], [email protected] now receives a verification message to use the application.

$admin = $account->admin()->create([
        'firstname' => $request['firstname'],
        'middlename' => $request['middlename'],
        'lastname' => $request['lastname'],
        'extension_name' => $request['extension_name'],
        'date_of_birth' => $request['date_of_birth'],
        'address' => $request['address'],
        'contact_number' => $request['contact_number'],
    ]);
$admin->account()->update(['password' => generatedPassword()]);
$request['email']->sendEmailVerificationNotification(); //assuming the email has been filtered and validated.

But I think it doesn't work, I didn't received any emails.

12 May
1 month ago

Chron started a new conversation What Folders That We Shouldn't Be Modifying?

What are the folders that reverts back, when modified, whenever I upgrade to the latest version?

11 May
1 month ago

Chron left a reply on Where Can I Modify The Email Verification?

@PATRICKADVANCE - Yeah, I knew that. But what about the built in logic?

Chron started a new conversation Where Can I Modify The Email Verification?

The email verification needs to be send again before the user can see the email, because at some reason, the first email verification didn't send.

Right after the user registered, it will be redirected to login, the user can login, however it will be redirected to email/verify. I want the user to receive the verification right after it saw the "an email verification has been sent to your email" message.

And whenever I verify the user, it automatically go to /login, I want to change it, so that its relative to the email verification address I sent to them. For example, if the email verification says

https://web-site.com/admin/email/verify/2?expires=token

I want it to redirect to

https://web-site.com/admin/login

Chron left a reply on Is It Possible For Mailing Verifications?

@BOBBYBOUWMANN - >prevent temporary emails you should build in some other check. Like expiring accounts after x months or require them to perform some extra check when signing up.

Yes, I said that to my client and yet they still insisted that the users of the application should only have yahoo or gmail accounts. I'm just giving them what they want :/

Chron left a reply on Is It Possible For Mailing Verifications?

make my own gmail account, some kind of a mail server, a mail sender that sends email verification

How can I achieve this in gmail? Is this smtp?

Chron left a reply on Is It Possible For Mailing Verifications?

@BOBBYBOUWMANN - Hmm, maybe also for yahoo users? I want to use them because they're the most used mail in our country at the same time, I want to only use those kinds of addresses to prevent temporary emails.

Chron started a new conversation Is It Possible For Mailing Verifications?

Is it possible to make my own gmail account, some kind of a mail server, a mail sender that sends email verification to other gmail users?