Chron

Chron

Member Since 6 Months Ago

Experience Points 5,710
Experience Level 2

4,290 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.

24 Jun
11 hours ago

Chron left a reply on Email Verification Problem

@SNAPEY - You're right. How did you deal with that problem? Did you just go with the laravel's way?

Chron left a reply on Email Verification Problem

@NAKOV - Ohhh, I thought there's a problem with it. But why does it need to be logged in first before verifying? Some websites allow emails to be verified even the user is not logged in.

Chron left a reply on Email Verification Problem

@NAKOV - I thought that when I clicked the "verify email" button in the verification email, it will automatically get verified.

Chron left a reply on Are There Any Differences With Redirects?

@JOHNBRAUN - Ohh, but what's the difference between the property and method redirectTo?

23 Jun
1 day ago

Chron started a new conversation Email Verification Problem

What could be the problem here? The email verification sends just fine but when I click the button for verifying the email address, I should be logged in first before verifying it, unless it wouldn't get verified and still showing the "Verify Email Address" message.

    protected function verificationUrl($notifiable)
    {
        return URL::temporarySignedRoute(
            'verification.verify',
            Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
            ['id' => $notifiable->getKey()]
        );
    }

I just copy and pasted this from the vendor file so I there's no problem with it. afaik.

Chron left a reply on Bug When I Manually Login Users

@CVIV - wait, what's the difference between the property and the method of redirectTo?

Chron left a reply on Bug When I Manually Login Users

@SNAPEY - Wait. So, I'm a logged in user and when I access the login page or any page that a logged in user shouldn't be accessing, it should redirect to /dashboard. Is it right?

Chron left a reply on Bug When I Manually Login Users

I updated the post with some additional information.

Chron left a reply on Bug When I Manually Login Users

@SNAPEY - You mean a small notification box to tell that the user is logged in? Yes.

Chron left a reply on Bug When I Manually Login Users

@CVIV - Yes, but I changed that to route('dashboard') that cannot be access if only a guest, so if the user gets logged in it will get redirected to dashboard route.

Chron left a reply on Bug When I Manually Login Users

@JLRDW - Yes. The only problem is, it doesn't get logged in and it gets redirected to home but when I try it the second time, it works.

22 Jun
2 days ago

Chron left a reply on Bug When I Manually Login Users

@JLRDW - ```php if (Auth::attempt(['email' => $email, 'password' => $password, 'active' => 1])) { // The user is active, not suspended, and exists. }


It has this block, so I just modified it a bit.

Chron started a new conversation Bug When I Manually Login Users

if (Auth::attempt(['email'=>request('email'), 'password'=>request('password'), 'account_type'=>"Admin"], request('remember'))) { 
    return redirect()->intended('/dashboard')->with('message', 'Welcome back');
}

It gets redirected to home as expected but only if they're not logged in but it gets redirected there even if I feed it with correct credentials and its not logged in when I do it the first time then then when I login again it redirects now to dashboard and its logged in. What could be the problem here? It's always the problem

Chron started a new conversation What Are Good WYSIWYG For Laravel?

What are good WYSIWYG that are FOSS and lightweight? I tried summernote but it has conflicts with the jquery version. I also tried quill but I'm getting Use of Mutation Events is deprecated. Use MutationObserver instead. whenever I import it in bootstrap.js

global.Quill = require('quill');
21 Jun
3 days ago

Chron left a reply on Scripts Not Running

@MUNAZZIL - I was running npm run watch. It automatically compiles the files when it was saved.

Chron started a new conversation Scripts Not Running

Why are my scripts not running when I put them in resources/js/app.js?

I'm using quill wysiwyg, I already imported the required files in bootstrap.js but I'm getting not a function error.

19 Jun
5 days ago

Chron left a reply on Is It Possible To Have Two Or More Requests In A Page?

Maybe I should just make a page for each of them?

17 Jun
1 week ago

Chron left a reply on Is It Possible To Have Two Or More Requests In A Page?

@LOUDRIOT - Yeah, I knew that. Also hey have different forms.

Chron left a reply on Is It Possible To Have Two Or More Requests In A Page?

@TRAY2 - How can I have them in a same page if I don't have them in the same endpoint then?

Chron left a reply on Is It Possible To Have Two Or More Requests In A Page?

@TRAY2 - I don't use vue in my project. One route gets overridden.

Route::patch('account/{info}/edit/', '[email protected]_account')->name('account.update'); //email and pwd
Route::patch('account/{info}/edit', '[email protected]_profile')->name('profile.update'); // other infos

They have the same endpoint so that's why it has that error.

Chron started a new conversation Is It Possible To Have Two Or More Requests In A Page?

Say, I have an edit form where all of the infos of user are there, that's one patch request. But I also have an email and password form, that's second request, because my logic is, even the user change its personal info it doesn't always have to change the account infos (email and password). Also for keeping the UI clean.

15 Jun
1 week 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
2 weeks 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
2 weeks 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
2 weeks 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
2 weeks 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
3 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
3 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
3 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
3 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?