Chron

Chron

Member Since 1 Year Ago

Experience Points
16,790
Total
Experience

3,210 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
27
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 4
16,790 XP
Sep
14
1 week ago
Activity icon

Replied to Is There A Way To Group Inputs And Validate Them As One Input?

How would it return errors to "year", "month", "date" separately?

Activity icon

Started a new Conversation Is There A Way To Group Inputs And Validate Them As One Input?

I'm using Laravel 5.8

<select id="month" name="month">
	<option selected disabled>Month</option>
	<option value="fooMonth">FooMonth</option>
	...
</select>
<select id="date" name="date">
	<option selected disabled>Date</option>
	<option value="fooDate">FooDate</option>
	...
</select>
<select id="year" name="year">
	<option selected disabled>Year</option>
	<option value="fooYear">FooYear</option>
	...
</select>

I want to validate them as one. Is there a way to validate it like this?

'month', 'date', 'year' => ['required', 'date']
Aug
14
1 month ago
Activity icon

Replied to Package.json DevDependencies

I'll take that in mind!

I moved all of my dependencies to devDependencies:

"devDependencies": {
        "@fortawesome/fontawesome-free": "^5.8.1",
        "admin-lte": "^3.0.2",
        "axios": "^0.18.1",
        "bootstrap": "^4.4.1",
        "cross-env": "^5.1",
        "flatpickr": "^4.6.3",
        "icheck": "^1.0.2",
        "inputmask": "^5.0.6-beta.5",
        "jquery": "^3.4.1",
        "knockout": "^3.5.1",
        "laravel-mix": "^4.0.7",
        "lodash": "^4.17.5",
        "luxon": "^1.24.1",
        "moment": "^2.24.0",
        "overlayscrollbars": "^1.10.0",
        "popper.js": "^1.12",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.15.2",
        "sass-loader": "^7.1.0",
        "select2": "^4.0.13",
        "summernote": "^0.8.18",
        "vue": "^2.5.17",
        "vue-router": "^3.0.6",
        "vue-template-compiler": "^2.6.10"
    },

I'm not sure if some of these packages are necessary when deploying the app. Do I need to remove any of these?

Activity icon

Replied to Package.json DevDependencies

That depends how you deploy to your shared hosting and if you have command line access.

I don't have access to the command line.

Do I need to remove any of the require before I deploy it? Here is the content of require and require-dev:

"require": {
        "php": "7.4.*",
        "barryvdh/laravel-snappy": "^0.4.4",
        "doctrine/dbal": "^2.9",
        "fideloper/proxy": "^4.0",
        "h4cc/wkhtmltopdf-amd64": "^0.12.4",
        "intervention/image": "^2.4",
        "laravel/framework": "5.8.*",
        "laravel/tinker": "^1.0",
        "laravolt/avatar": "^2.2",
        "maatwebsite/excel": "^3.1",
        "mews/purifier": "^3.2"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^7.5"
    },

Should I just remove all of the packages in require-dev?

Aug
13
1 month ago
Activity icon

Replied to Package.json DevDependencies

@bobbybouwmann What if I deploy the app on shared hosting? Should I remove the composer's dev dependencies first before I deploy the app?

Activity icon

Started a new Conversation How To Automatically Remove # At The End Of The Link?

If the user put a # at the end of the link, eg. www.example.com/test#, is there a way to remove it?

Activity icon

Replied to Package.json DevDependencies

@bobbybouwmann Is it the same with composer.json? Should I move all of the packages to require-dev? or should I remove packages first that were meant for development only?

Aug
12
1 month ago
Activity icon

Replied to Package.json DevDependencies

@bobbybouwmann So I should move all of dep to devDep?

Activity icon

Replied to Package.json DevDependencies

Yes, I compile them before commit or deploy. Is there a reason why I should move all of them to devDep?

Activity icon

Started a new Conversation Package.json DevDependencies

Is it okay to move all the devDependencies to dependencies? Here are the packages:

"devDependencies": {
        "cross-env": "^5.1",
        "jquery": "^3.4.1",
        "laravel-mix": "^4.0.7",
        "lodash": "^4.17.5",
        "popper.js": "^1.12",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.15.2",
        "sass-loader": "^7.1.0",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10"
},

Or are there any of these packages that needs to be only in devDep?

Aug
09
1 month ago
Activity icon

Replied to How To Only Load Needed Js File?

@sinnbeck Oh, Aren't all of the packages that are loaded should be inside bootstrap.js?

Activity icon

Replied to How To Only Load Needed Js File?

@sinnbeck Here it is

bootstrap.js

window.$ = window.jQuery = require('jquery');
import Inputmask from "inputmask";

//tried this as well
//var Inputmask = require('inputmask');

app.js

$(function () {
 	
 	let date = document.querySelector(".input-date");

 	Inputmask("mm-dd-yyyy", {
        leapday: "02-29-",
        placeholder: "_",
        yearrange: {
          minyear: 1950,
          maxyear: 1999
        },
        showMaskOnHover: true,
        showMaskOnFocus: false,
        clearIncomplete: true,
      }).mask(date)
})
Aug
08
1 month ago
Activity icon

Replied to How To Only Load Needed Js File?

@sinnbeck I did that, I'm now getting Inputmask is not defined.

Activity icon

Started a new Conversation How To Get Keycode In An Input Event

Here is the code:

let el = document.querySelector("input[name='test']")

el.addEventListener('input', (e)=>{
 console.log(e.keyCode)
})

But e only points the actual element. Is there a way to get the key code as well?

Aug
06
1 month ago
Activity icon

Replied to How To Only Load Needed Js File?

Also ensure jquery is loaded in bootstrap.js

It is.

window.$ = window.jQuery = require('jquery');
import Inputmask from "inputmask";

I tried it and it's still the same.

Activity icon

Started a new Conversation How To Only Load Needed Js File?

I'm using Input mask v3.3.11.

Here is the github: https://github.com/RobinHerbots/Inputmask

I already have this:

//bootstrap.js
import inputmask from "inputmask/dist/min/jquery.inputmask.bundle.min.js";

I use it like this:

$("element").inputmask({
	//....
});

But I'm getting TypeError: $(...).inputmask is not a function error.

Activity icon

Started a new Conversation Reference Error `name` Not Defined When Importing Or Requiring

I'm using luxon js.

Here's the installation manual: https://moment.github.io/luxon/docs/manual/install.html

I have already tried:

//
const { DateTime } = require("luxon");

//
import { DateTime } from "luxon";

//
import DateTime from "luxon";

All of them gave a ReferenceError: DateTime is not defined. Is there a way to fix this?

Aug
01
1 month ago
Activity icon

Replied to What's The Most Recommended Date And Time Picker To Use For Web And Mobile App?

@artcore What time picker do you use?? Do you have any recommendations? The pen didn't work, it still showing the error.

Jul
31
1 month ago
Activity icon

Replied to What's The Most Recommended Date And Time Picker To Use For Web And Mobile App?

is there a way to not set the time by default when opened the timepicker?

Activity icon

Started a new Conversation What's The Most Recommended Date And Time Picker To Use For Web And Mobile App?

What's the most recommended date and time picker that has a option to put min and max value to use for web and mobile app?

Jul
22
1 month ago
Activity icon

Replied to Mask Inputs

It has bugs regarding to date masking.

https://github.com/RobinHerbots/Inputmask/issues/1922

Jul
20
2 months ago
Activity icon

Replied to Mask Inputs

I can't mask tel number with type password.

Jul
19
2 months ago
Activity icon

Started a new Conversation Mask Inputs

Is there a way to mask inputs? I tried this package: https://github.com/RobinHerbots/Inputmask but it has noticeable bugs.

Jul
11
2 months ago
Activity icon

Started a new Conversation Date And Time Picker

are there any date and time picker for laravel? I wanted to use the vanilla <input type="datetime"> but it is obsolete, I use firefox so datetime-local doesn't work yet either. I have tried tempus-dominus and daterangepicker but all of them just didn't fit my needs. I want a date and timepicker to have a min and max value that doesn't automatically fill the textbox once the page finished loading and can be opened always.

Jul
10
2 months ago
Activity icon

Started a new Conversation Tempus Dominus

Is there a way to set tempus dominus' maxDate without showing it in the textbox on load?

I have this:

 $('#date').datetimepicker({
    format: 'YYYY-MM-DD',
    minDate: (new Date('1950-01-01')),
    maxDate: (new Date('2000-12-31')),
  });

When I use useCurrent: false, yes, it doesn't show the date but it starts at the current date when opened the picker. I want it to hide the text on load and start at whatever maxDate was set to.

Jul
09
2 months ago
Activity icon

Started a new Conversation Relationships

For example, I have a model called User, is there a way to know all of the models related to it?

Jul
08
2 months ago
Activity icon

Started a new Conversation Default Value

Is there a way to have a default value without creating a record??

Activity icon

Started a new Conversation How Do Disable Foreign Key Checks In Tinker?

Is there a way to disable foreign key checks via tinker?

Jul
07
2 months ago
Activity icon

Started a new Conversation Is There A Way To Double Redirect?

Is there a way to hit the first route before going to the second redirection?

Activity icon

Replied to Conditional Redirect

Maybe double redirect it? Redirect first to product.create so that the url() records it then redirect again to people.create?

Activity icon

Replied to Conditional Redirect

Here's what I've done:


//ProductController
public function create() {

            $queryP = People::query();

            if($queryP->count()) {

                $people = $queryP->get();

                return view('product.create', compact('people'));

            }else {

                session()->flash('errorEmpty', 'You have to create people first.');       

                return redirect()->route('people.create');

            }
}

//PeopleController

public function store(Request $request) {

    	//......validation and storing of people records


        if (previous_route_is('product.create')) {

	   dd('hit');

        } else {

           return redirect()->route('people.create')->with('message', 'People added.');

       }

    }

I came from the /dashboard route, clicked the product to create but redirected to people.create route, which is what I wanted, but when I'm done creating people, it didn't passed the condition though, so it didn't dump and die.

Activity icon

Replied to Conditional Redirect

Where can I put the helper?

Activity icon

Started a new Conversation Conditional Redirect

For example, I have People, Accounts, and Products.

All of them have their controllers, models and tables.

But the user can only create products when both people and accounts are not empty.

So, the user will be redirected to route('people.create') if the user went to route('product.create') but peoples table is empty

So, If the user has completed creating people record, it will be redirected back to route('product.create').

Is there a way to check whether the user went to the page because of redirection or just a normal navigation?

Activity icon

Replied to How To Deal With Processes That Needed To Be Done In Sequence

I just saw it. What is that called?

Jul
06
2 months ago
Activity icon

Replied to How To Deal With Processes That Needed To Be Done In Sequence

No, I'm sorry if I was unclear. I'm only talking about the UI for the users.

Activity icon

Started a new Conversation How To Deal With Processes That Needed To Be Done In Sequence

How do you deal with processes that needed to be done in sequence?

For example, You need to create records for Person and Account first before making a record for Product.

I thought of using Bootstrap Breadcrumbs but Product is not the only one that depends on Person and Account.

Activity icon

Replied to Time With Date And After_or_equal Validation Returns An Error

I want it to be like this:

'date' =>      'required|date|after_or_equal:today',
'time' => 'required|date|after_or_equal:today,'.$request['date'].' '.$request['time']
Activity icon

Started a new Conversation Time With Date And After_or_equal Validation Returns An Error

I have this:

'date' =>      'required|date|after_or_equal:today',
'time' =>      'required|date_format:H:i|after_or_equal:today',

It's currently 13:42, 2020-07-06.

For example, I entered 2020-07-07, which is tomorrow, in date field, and 07:30 in time field, it returns an error that says the time must be a date after or equal to today., which is expected.

But is there a way to include the date when validating time?

So the time field would check the time with the date? So it will go to validation like this: 2020-07-07 07:30

Activity icon

Replied to Is There A Way To Convert A Full Date To Milliseconds?

For example, I got this

date: 2020-07-06 20:17:28.900295

I want to convert the whole date to milliseconds or something that can be compared to another date like that.

Activity icon

Started a new Conversation Is There A Way To Convert A Full Date To Milliseconds?

Is there a way to convert a now() to milliseconds?

Jul
05
2 months ago
Activity icon

Started a new Conversation Checkbox Validation

I have this:

<input type="checkbox" name="checkbox" id="checkbox" value="1"> Is this true?
$data = $request->validate([
    		'field1' => ['required'],
    		'field2' => ['required'],
            	'checkbox' => ['boolean']
  	     ]);

Model::create([
			'field1' => $data['field1'],
			'field2' => $data['field2'],
			'checkbox' => $data['checkbox'],
]);

Whenever I don't check the box, I get a validation error saying it must be boolean

Jul
03
2 months ago
Activity icon

Started a new Conversation Prevent User Access If There's No Record

Is there a way to prevent a user from accessing a route if there's no record? Is there a way to do all of that in one file? Kind of like how view composer works?

//view composer

view()->composer('*', function ($view){
            $view->with('user_count', User::count());
})
Jul
01
2 months ago
Activity icon

Started a new Conversation Is There A Way To Grab All The Html Tags Then Replace Them With Space?

The input is from a wysiwyg, is there a way to grab all the html tags then replace them with spaces?

Jun
30
2 months ago
Activity icon

Started a new Conversation Html Purifier Not Working

I'm using mewebstudio/purifier package

I have this in config/purifier.php

'HTML.Allowed'             => 'div,b,strong,i,em,u,ul,ol,li,p[style],br,span[style],img[width|height|src|style]',

As you can see, the img doesn't have alt, but the alt is still there when I die and dump the output. Is there a way to fix this?

Activity icon

Started a new Conversation Summernote On Laravel

Is there a way to automatically go to a next line when uploaded an image in the editor? Kind of like how trix works: https://trix-editor.org/

I saw a laravel-trix package but it must follow the naming convention, when I use the node trix version, the toolbar doesn't work, so I came back to summernote.

Activity icon

Started a new Conversation Remove Package From Node_modules

I already tried:

npm uninstall --save-dev [email protected]
npm uninstall [email protected]

But the package is still in node_modules, and I'm getting this warning:

npm WARN tempusdominus-bootstrap-4@5.1.2 requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.

Jun
28
2 months ago
Activity icon

Started a new Conversation Is There A Way To Validate A Form As A Group?

For example, I have the input for name, age, role

Is there a way in form request to validate these fields as a group? Right now, I'm doing it like this:

'name' => ['required', new ValidationEx($this->name, $this->age, $this->role)],
'age' => ['required', new ValidationEx($this->name, $this->age, $this->role)],
'role' => ['required', new ValidationEx($this->name, $this->age, $this->role)],
Jun
25
2 months ago
Activity icon

Replied to Is There A Way To Eager Load Models With "has"?

Solved it. The has method should be whereHas without square brackets.

Model1::whereHas('models2', $callback)
    ->with(['models2' => $callback])
    ->get();