tha07

tha07

Member Since 5 Months Ago

Experience Points 2,400
Experience Level 1

2,600 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 20
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.

26 Feb
2 weeks ago

tha07 left a reply on Using UUIDs Over Auto Increment

@DARIUSIII - Thank you. I'll check this out :)

tha07 left a reply on Using UUIDs Over Auto Increment

@BOBBYBOUWMANN - Thank you. Yep. I have not done in any projects. Maybe I should start from this one :)

tha07 started a new conversation Using UUIDs Over Auto Increment

I have an admin and guest interface in my application. If I want to implement UUIDs only for guest interfaces what is the approach? Or do I need to stick with auto increment IDs. (Guest interfaces will only include "get" requests)

24 Feb
3 weeks ago

tha07 left a reply on Prompt To Change Password If Default Password

@ORION - Hi Orion. I have guest and admin user types. will it not be a problem when dealing with several user types?

tha07 started a new conversation Prompt To Change Password If Default Password

I'm creating a function to check the authenticated users password with the app's default password and prompt user to change password.

I think the best way is to do it via a middleware. But was not able to achieve it.

How can I check it from a middleware and redirect user to a specific route to force to enter a password

12 Jan
2 months ago

tha07 started a new conversation My First Big App - Structuring Issue

Hi, I'm new to Laravel and loving it. I'm on my way to create my first big app for a laboratory. I'm in the plan stage and have this issue.

I have planned several tables. customers, tests, customer_tests, test_properties, customer_test_property_results

Example for a test is "high blood pressure". Each test have several properties like white blood cell count, red blood cell count with there necessary max values and min values. this properties vary according to the test.

After customer register for a test and the test is done by the lab, the test results are entered by the app. I will create this form with every test property to enter there respected values.

The problem is How can I validate the form data? The form values are varying with each test types. So the controller function which test data results are validating don't know what test is coming to do the validations. Is there any dynamic way to do this?

01 Oct
5 months ago

tha07 started a new conversation Problem In Structuring Models, Controllers And Tables

Let's say I have Clients and Tests tables. A client will register for many tests. And keep registering for the same test again. The normal procedure I use is creating a model called ClientTest and also a controller for model as ClientTestController. Also a route named clienttest to implement the crud functionalities for the table.

Is it the best practice or is there any better way to handle it?

29 Sep
5 months ago

tha07 left a reply on Route For Different User Types

Thank you :)

tha07 started a new conversation Route For Different User Types

I have a project that is been setup for middleware as this way. This routes are available only for role 1 user role. I want them available for both role 1 & 2 user roles.

I tried adding 'auth', 'Role:1', 'Role:2' but it didn't work

my routes\web.php file

Route::group(['prefix' => ADMIN, 'as' => ADMIN . '.', 'middleware'=>['auth', 'Role:1']], function() {
    Route::get('/', 'Dashboar[email protected]')->name('dash');
    Route::resource('users', 'UserController');
    Route::resource('businesses', 'BusinessController');
});

my App\Http Kernal File

protected $routeMiddleware = [
    ...
    'Role' => \App\Http\Middleware\Role::class,
];

my App\Http\Middleware Role File

public function handle($request, Closure $next, $role)
    {

        // Not Logged
        if (!Auth::check()) {
            return redirect('/login');
        }

        // Not allowed
        if ($request->user()->role != $role) {
            return abort(404);
        }

        return $next($request);
    }
28 Sep
5 months ago

tha07 left a reply on Can You Explain This Code

Thank you very much

tha07 left a reply on Can You Explain This Code

what is the $role here?

tha07 left a reply on Can You Explain This Code

In Kernal.php I have,

protected $routeMiddleware = [
    ...
    ...
    'Role' => \App\Http\Middleware\Role::class,
];

In Role.php I have,

public function handle($request, Closure $next, $role)
    {
        // Not Logged
        if (!Auth::check()) {
            return redirect('/login');
        }

        // Not allowed
        if ($request->user()->role < $role) {
            return abort(404);
        }
        return $next($request);
    }

tha07 started a new conversation Explain This Code

I have this code in the routes web file. I find it difficult to understand.

Route::group(['prefix' => 'admin', 'as' => 'admin'. '.', 'middleware'=>['auth', 'Role:0']], function() {
    Route::get('/', '[email protected]')->name('dash');
    Route::resource('users', 'UserController');
});

Does it mean that the Role 0 users only have the access to the following Routes?

22 Sep
5 months ago

tha07 left a reply on $ Is Not Defined - Jquery Not Found

thank you for your feedbacks. I think I should read more about mix. Actually this is a template. I go this error while compiling it. Manged to solve it by importing jquery in the app.js file like this.

import $ from 'jquery';
window.jQuery = $;
window.$ = $;

tha07 left a reply on $ Is Not Defined - Jquery Not Found

@hollyit

here how my bootstrap.js file looks like.

import './masonry';
import './charts';
import './popover';
import './scrollbar';
import './search';
import './sidebar';
import './skycons';
import './vectorMaps';
import './chat';
import './datatable';
import './datepicker';
import './email';
import './fullcalendar';
import './googleMaps';
import './utils';
import './sweetalert2';
import './select2';

so you're telling that i have to add jquery to this file?

tha07 left a reply on $ Is Not Defined - Jquery Not Found

It still doesn't work

tha07 started a new conversation $ Is Not Defined - Jquery Not Found

In my Laravel project (laravel 5.6) I installed Jquery from npm. Then I added it to webpack.mix.js.

mix.webpackConfig(webpack => {
    return { plugins: [new webpack.ProvidePlugin({
                $: "jquery",
                jQuery: ["jquery", "$"],
                "window.jQuery": "jquery",
                Popper: ["popper.js", "default"]
            })] };
});

after compiling the assets and trying to use jquery it shows

"Uncaught ReferenceError: $ is not defined"

I am using my custom JavaScript file after loading the mix file in my view.

```php
<script src="{{ mix('/js/app.js') }}"></script>
<script type="text/javascript" src="/js/tests/tests.js"></script>

In my custom JavaScript file I added the following code to check Jquery.

```javascript
$("#myCheckButton").click(function(e) {
  console.log(test);
});

I tried changing the webpack.min.js webPackconfig settings but was not able to solve it. Most questions like this recommended to put the custom js files after the mix. I think I got it right in my case