Chron

Chron

Member Since 5 Months Ago

Experience Points 4,170
Experience Level 1

830 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 24
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.

13 May
1 week 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
2 weeks 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
2 weeks 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?

Chron started a new conversation How Can I Group Routes That Have Similar Class Names?

How can I group routes?

Route::namespace('Customer')->group(function (){
    Route::prefix('customer')->group(function (){
        Route::namespace('CustomerAuth')->group(function (){
            Route::post('login', '[email protected]');
            Route::post('register', '[email protected]');
            Route::name('customer.')->group(function (){
                Route::get('login', '[email protected]')->name('login');
                Route::post('logout', '[email protected]')->name('logout');
                Route::post('password/email', '[email protected]')->name('password.email');
                Route::get('password/reset', '[email protected]')->name('password.request');
                Route::post('password/reset', '[email protected]')->name('password.update');
                Route::post('password/reset/{token}', '[email protected]')->name('password.reset');
                Route::get('register', '[email protected]')->name('register');
            });
        });
    });
});

I have similar routes but with Admin, they have different login pages, namespaces, routes (like admin/register and customer/register), but same class names.

07 May
2 weeks ago

Chron started a new conversation Email Verification

Auth::routes(['verify' => true]);

I see this in the documentation,but what if I made a custom register and login routes? Where can I add "'verify' => true"?

Like this.

Route::namespace('Admin')->group(function (){
    Route::prefix('admin')->group(function (){
        Route::namespace('AdminAuth')->group(function (){
            Route::post('login', '[email protected]');
            Route::post('register', '[email protected]');
            Route::name('admin.')->group(function (){
                Route::get('login', '[email protected]')->name('login');
                Route::post('logout', '[email protected]')->name('logout');
                Route::post('password/email', '[email protected]')->name('password.email');
                Route::get('password/reset', '[email protected]')->name('password.request');
                Route::post('password/reset', '[email protected]')->name('password.update');
                Route::post('password/reset/{token}', '[email protected]')->name('password.reset');
                Route::get('register', '[email protected]')->name('register');
            });
        });
    });
});

05 May
3 weeks ago

Chron started a new conversation Getting An Error/warning By Using An Alias

I've got all my aliases in ~/.bashrc, those aliases are working when I'm outside mysql or tinker.

I have this in ~/.bashrc, that are related with tinker.

alias c='clear'
alias e='exit'
03 May
3 weeks ago

Chron left a reply on Having Two Post Request With Different Route Name Prefixes

@FTIERSCH - Yeah, sorry. I messed up the logic, I supposed to update it not create... So it should be:

Route::post('[email protected]')->name('schedule.store');
Route::put('[email protected]')->name('schedule.toggle');

Chron started a new conversation Having Two Post Request With Different Route Name Prefixes

Here's my web.php:

Route::post('[email protected]')->name('schedule.store'); //stores schedule
Route::post('[email protected]')->name('schedule.toggle'); //temporarily disabling schedule

I noticed that toggle overrides store when I looked it up using r:l, how can I prevent doing that?

26 Apr
1 month ago

Chron left a reply on (One To One) To (Zero To Many) / (Zero To One) To (One To Many)

@SNAPEY - Ohh.. Sorry.. I just got intertwined with the names. I'll mark this thread as solved! Thanks @devfrey and @snapey for helping!

Chron left a reply on (One To One) To (Zero To Many) / (Zero To One) To (One To Many)

@SNAPEY - Hmmmmm... But phones table has the "child_id" so the phone model should have the "belongsTo"

Chron left a reply on (One To One) To (Zero To Many) / (Zero To One) To (One To Many)

@DEVFREY - Ohh...Got it!

So it will just looked like a normal one to many relationship? Like this..

public function phones(){
    return $this->belongsTo(Child::class);
}

public function phones(){
    return $this->hasMany(Child::class);
}

Chron left a reply on (One To One) To (Zero To Many) / (Zero To One) To (One To Many)

@DEVFREY - When does a pivot table necessary to use?

Chron started a new conversation (One To One) To (Zero To Many)

Is this possible without making a pivot table? For example..

One child has/have zero to many Phones

I think it can be easily achieved with something like this..


$child = Child::create([
    'name' => $request['name'],
    'age' => $request['age'],
]);
if($child->has('phones')){
    //add child infos into the phones table.
    $child->phones()->create([
    'child_id' => $child->id;
    'model' => $request['model'],
])

}
else{  // if the child doesn't have any phone
    //just create the child account
    
}

Add the child infos to the phones table ONLY if they have any phones.

From what I see, this is just okay because the foreign key "child_id" in phones table will never get a null value unless the child has a phone.

I've heard of belongsToMany, that deals with many to many relationships but can it the also deal with zero to many relationship?

22 Apr
1 month ago

Chron started a new conversation Snappy Package And Bootstrap 4

Is there a way to make rows and cols work on snappy? Pseudo classes also don't work. Is there any pdf generators for laravel that supports the BS4 or pseudo classes?

21 Apr
1 month ago

Chron left a reply on Address Already In Use

Okay, apparently dompdf is the culprit. I noticed that when I visit a page that goes to print view, the error occurred but it stopped after I modified my code. Thanks for helping everyone!

Chron left a reply on Address Already In Use

@DIEGOAURINO - Aren't firewalls/MAC already configured on installation?

Chron left a reply on Address Already In Use

@DIEGOAURINO - Yes. I tried it. Same problem. I terminated the artisan serve and the tab that runs php artisan serve said its terminated.

Chron left a reply on Trying To Get Property Of Non-object

@NEMRUT - I'm trying it.. But it loads too slow..

Chron left a reply on Address Already In Use

@DIEGOAURINO - I got this. ps aux | grep -i port

chronic+ 15764  0.0  0.1   6276  2096 pts/4    S+   18:20   0:00 grep --colour=auto -i port

ps aux | grep -i artisan

chronic+ 15750  7.0  2.0  97132 30300 pts/0    S+   18:19   0:00 php artisan serve
chronic+ 15757  0.0  0.1   6276  2188 pts/4    S+   18:19   0:00 grep --colour=auto -i artisan

Chron started a new conversation Trying To Get Property Of Non-object

I'm using barryvdh/laravel-dompdf. When I pass the data of the current user I get the said error.

Controller

public function viewAssessment() {
        $user = Auth::user()->customer;
        $pdf = \PDF::loadView('print', compact('user'));
        return $pdf->stream('invoice.pdf');

    }

View

Chron left a reply on Address Already In Use

@DIEGOAURINO - @diegoaurino I'm using Manjaro OS. @snapey I'm using barryvdh/laravel-dompdf when that occurred.

Chron left a reply on Address Already In Use

@SIANGBOON - I tried changing the port and the issue is still the same.

Chron started a new conversation Address Already In Use

This error didn't occurred until now. Whenever I run php artisan serve, It gives me 127.0.0.1:8000, it works a couple of minutes but after that the page just keeps loading until I restart the server and gives me an error Failed to listen on 127.0.0.1:8000 (reason: Address already in use) and gives me other port. Is there a way to trace what uses the default port?

20 Apr
1 month ago

Chron started a new conversation Not Seeing Any Errors Except The 500 Server Error

I don't see any errors when I have any mistakes in my code. I only see them in storage/logs folder. This didn't occur yesterday.

Chron left a reply on Is There A Way To Make The Chain Dynamic?

Do I have to create new class when I have 5 different account types? :/

Chron left a reply on Is There A Way To Make The Chain Dynamic?

@BOBBYBOUWMANN - Wow, I totally forgot that rule. But I know that this will make the code messy and far more unreadable tbh.

switch ($request['account_type']) {
if (Auth::user()->account_type == 'Company') {
                switch ($request['account_type'] == 'Customer') {
                    case 'Customer':
                    Customer::create([
                        'acc_id' => $acc->id,
                        'firstname' => $request['firstname'],
                    ]);
                    return redirect('/create')->with('message', 'Customer created successfully!');
                    break;               
                    default:
                    return redirect('/create')->with('message', 'There\'s something wrong with the request.');
                    break;
                }
            }

Let me explain my logic.. You can only make a customer account when you're part of a company. There are other accounts beside Customer like Cashiers etc. so the switch case will get longer and more messy. Unless... This kind of task can be done with Laravel Gates or Policies???? Never read those yet though which is a bummer.

Chron started a new conversation Is There A Pdf Version Of The Docs?

I still have a lot to learn but the internet connection is the problem. The school I'm in doesn't have that. I want to study the framework while I'm at school and still young. The pdfs I'm seeing in the internet are <=5.7. The framework updates fast so I really want to catch up.

Chron left a reply on Is There A Way To Make The Chain Dynamic?

@bobbybouwmann @sergiu17 Yes, I already created those. I also added relationship to each of the models.

Chron started a new conversation Is There A Way To Make The Chain Dynamic?

I want to make it like this..

$user = strtolower($request['acc_type']).'()';

That will determine where the registered user will go.

Account::create([
            'email' => $request['email'],
            'password' => Hash::make($request['password']),
            'acc_type' => $request['acc_type'], //------------------->> It can be "Admin", "Customer", "Company"
        ])->$user->create([
            'firstname' => $request['firstname'],
        ]);

But I got this error..

Call to a member function create() on null

Chron left a reply on App.css Reverting Back

@LINDSTROM - Ohh.. So I have to use the app.scss when editing and not app.css ?

19 Apr
1 month ago

Chron started a new conversation App.css Reverting Back

I want to import fontawesome inside app.scss but whenever it compiles the app.css reverts back.

16 Apr
1 month ago

Chron left a reply on Setting Initial Value For Incrementing Ids

How about adding a hyphen? like 35-11111 where only 11111 increments.

Chron left a reply on Setting Initial Value For Incrementing Ids

I've seen that before I posted this. It's been a couple of years and I thought they've added that in the later updates. So Tyler really don't want to add it huh? Understandable.

Chron started a new conversation Setting Initial Value For Incrementing Ids

Is there a way in laravel58 to set initial value for primary keys?

Chron started a new conversation Change Login Method That Ships With The Framework

I want to change it so that I could add more constraints to it, like Select * from users where acc_type = 'user|admin|etc...'

14 Apr
1 month ago

Chron started a new conversation Got An Exception For Changing Config/auth.php

I got this error:

Argument 1 passed to Illuminate\Auth\TokenGuard::__construct() must implement interface Illuminate\Contracts\Auth\UserProvider, null given

Here's my config/auth.php

<?php

return [

    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
    ],


    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'accounts', //------- when this is changed to 'users' same with the providers I get no error
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
            'hash' => false,
        ],
    ],



    'providers' => [
        'accounts' => [ //-------------------------- when this is changed to 'users I get no error'
            'driver' => 'eloquent',
            'model' => App\Account::class,
        ],
        'admins' => [
            'driver' => 'eloquent',
            'model' => App\Admin::class,
        ],


        // 'users' => [
        //     'driver' => 'database',
        //     'table' => 'users',
        // ],
    ],


    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
        ],
    ],

];

Chron left a reply on These Credentials Do Not Match Our Records.

I manage to solve it by changing c/auth.php where the providers are. Thanks for helping @snapey !

Chron left a reply on These Credentials Do Not Match Our Records.

Uhhh... I've never heard that until now. Wait, I'll try to install it.

Chron left a reply on These Credentials Do Not Match Our Records.

@SNAPEY - But I do have separate login routes and controllers

--AdminAuth
    |___    ForgotPasswordController.php
    |___    LoginController.php
    |___    RegisterController.php
    |___    ResetPasswordController.php
    |___    VerificationController.php

--CustomerAuth
    |___    ForgotPasswordController.php
    |___    LoginController.php
    |___    RegisterController.php
    |___    ResetPasswordController.php
    |___    VerificationController.php
    
Route::get('/admin', '[email protected]')->name('admin.home');
Route::get('/admin/login', 'AdminAuth\[email protected]')->name('admin.login');
Route::post('/admin/login', 'AdminAuth\[email protected]');
Route::post('/admin/logout', 'AdminAuth\[email protected]')->name('admin.logout');
Route::post('/admin/password/email', 'AdminAuth\[email protected]')->name('admin.password.email');
Route::get('/admin/password/reset', 'AdminAuth\[email protected]')->name('admin.password.request');
Route::post('/admin/password/reset', 'AdminAuth\[email protected]')->name('admin.password.update');
Route::post('/admin/password/reset/{token}', 'AdminAuth\[email protected]')->name('admin.password.reset');
Route::get('/admin/register', 'AdminAuth\[email protected]')->name('admin.register');
Route::post('/admin/register', 'AdminAuth\[email protected]');

Chron started a new conversation These Credentials Do Not Match Our Records.

I did a separate Auth for Admin User and I didn't create @login method 'cause it didn't had any errors earlier.

Here's my @register method inside \AdminAuth\RegisterController.php

protected function register(Request $request)
    {
        Account::create([
            'email'=>$request['email'],
            'password' => bcrypt($request['password']), //tried this also with Hash::make($request['password']);
            'account_type'=>$request['account_type']])
        ->admin()->create([
            'firstname'=>$request['firstname'],
            'middlename'=>$request['middlename'],
            'lastname'=>$request['lastname'],
            'suffix_name'=>$request['suffix_name'],
            'date_of_birth'=>$request['date_of_birth'],
            'address'=>$request['address'],
            'contact_number'=>$request['contact_number'],
        ]);
        return redirect()->route('admin.login');
    }
13 Apr
1 month ago

Chron started a new conversation Controlling A Route Based On The User's Input

What I want is abort page if the user's input didn't met the requirements. If it met the requirements, the page will only be available until the user's input date don't met the conditions anymore.

Maybe having a Route like this...

if(now() <= $startDate){
    Route::resource('/private','PrivateController');
}

Route::fallback(function(){
    return 'Page not available';
});

And a method inside Controller like this...

public function privateAccess(Request $request){
    $startDate => $request['start_date'];
    return $startDate;
}

I know my code is off, but I hope you understand what I'm trying to say here.

12 Apr
1 month ago

Chron left a reply on Is There Any Way To Change The Default `User` Table That's Used For Auths

@WILBURPOWERY - Yeah, I did that already but I still get the users not found error though.