mvd

Member Since 4 Years Ago

Leusden

Experience Points 65,340
Experience Level 14

4,660 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 320
Lessons
Completed
Best Reply Awards 52
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

16 Sep
20 hours ago

mvd commented on Go Go Gadget Tailwind

Try to rebuild the node_modules

  • Delete the node_modules folder
  • Delete the package-lock.json file

Run

npm install
npm watch

mvd left a reply on Using Laravel 5.8 Authentication With External JSON API (Creating Own ServiceProvider)

@javid020

What do you mean with not logged in? Is this another request after the login request?

mvd left a reply on Using Laravel 5.8 Authentication With External JSON API (Creating Own ServiceProvider)

Hi @javid020

Did you call Auth::login($user);? Can you show us the login functionality?

13 Sep
3 days ago

mvd left a reply on Loop Constraining By Using Parent ID

Hi @kamfu

Why don't you add a relationship in your model for this. In your Category model

  public function posts() {
      return $this->hasMany(Post::class, 'parent_id', 'id');
  }

Your query

$results = Category::select('id','name')->latest()->with('posts')->get();
12 Sep
4 days ago

mvd left a reply on Set A E-mail Client For WAMP

@mego also cleared the cache? php artisan config:cache

If you run phpinfo(); What are the values for 'SMTP' and 'smtp_port' ?

11 Sep
5 days ago

mvd left a reply on Drag-n-drop Sorting With Child Elements

Hi @twg_

I don't know your database table structure but I suggest to create a parent column. Fill the parent ID in the parent column for the child element if it's dragged as a child.

06 Sep
1 week ago

mvd left a reply on Set A E-mail Client For WAMP

Hi @mego

What are your mail settings in .env?

If you use port 25 in test-mail-server-tool, try this settings in your .env config

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=NULL

mvd left a reply on "The Table Is Empty :-("

@b1narylife are you sure $this->withoutExceptionHandling(); is in your test and not disabled?

Can you give us the store method (where you save a new project) code from your projects controller?

mvd left a reply on "The Table Is Empty :-("

@b1narylife

Are you sure the columns title and description exists or are there more required fields?

If a remove $this->withoutExceptionHandling() and a have a wrong column name / missing a required field I get the same error/failere.

04 Sep
1 week ago

mvd left a reply on Delete Request In Vue Js Using Axios An Sweet Alert

Hi @jet

I never used Falcon but give it a try/guess, is there a method delete in your AcademicSessionController controller and what is the code in this method?

mvd left a reply on Delete Request In Vue Js Using Axios An Sweet Alert

Hi @jet

Are there errors in your browser console? If there are no errors, what is the PHP code/method for api/academic-session/ + id ?

03 Sep
1 week ago

mvd left a reply on Did Laravel Carbon And Eloquent Has Or Do Like Subtime() In Mysql

Hi @chalahed

In Eloquent you can use the raw functionlity

$total = "49:00:00";
  $foo = "09:00:00";
  $users = DB::table('users')
    ->select(DB::raw('SUBTIME("' . $total . '", "' . $foo . '")'))
    ->get();

In Carbon, check the 'Addition and Subtraction' section https://carbon.nesbot.com/docs/#api-addsub

mvd left a reply on Upload Image From Computer With Tiptap Vue JS

Hi @browniecoffee

Not by default but in this topic, in the second post there is some code to upload an image and use it in the editor. https://github.com/scrumpy/tiptap/issues/89

27 Aug
2 weeks ago

mvd left a reply on Add Created_by And Modified_by Values To Database On Form Submission

Hi @supunsam

Why you want to store the name and not the user id? The ID is a much better reference. If users change their name your lost the reference for example.

You don't have to pass the id/name in the form but you can call the user ID in your controller by

Auth()->user()->id; // user ID
Auth()->user()->name; // user name.
26 Aug
3 weeks ago

mvd left a reply on How To Just Check If User Exists And Do Not Create It In Google AOTH

@mostafalaravel

And what if you change

if (!$user) {
        abort(response('Unauthorized', 401));
      }

to

if (!$user) {
       return $user;
      }

And

try {
            $user = $service->createOrGetUser(Socialite::driver('google')->stateless()->user());
        } catch (\Exception $e) {
            abort(404);<--------------- HERE
        }

to

$user = $service->createOrGetUser(Socialite::driver('google')->stateless()->user());
if (!$user->count()) {
    abort(403);
}

mvd left a reply on How To Just Check If User Exists And Do Not Create It In Google AOTH

Hi @mostafalaravel

Did you use this tutorial, https://medium.com/@confidenceiyke/laravel-5-8-google-socialite-authentication-a8b57aa59241?

If this is the case, in step 6

$user = User::create([
                    'email' => $providerUser->getEmail(),
                    'name' => $providerUser->getName(),
                    'password' => md5(rand(1,10000)),
                ]);
            }

This create the user, you can change this class/file to

<?php
namespace App\Services;

use App\SocialGoogleAccount;
use App\User;
use Laravel\Socialite\Contracts\User as ProviderUser;

class SocialGoogleAccountService
{
  public function createOrGetUser(ProviderUser $providerUser)
  {
    $account = SocialGoogleAccount::whereProvider('google')
      ->whereProviderUserId($providerUser->getId())
      ->first();
    if ($account) {
      return $account->user;
    } else {
      $account = new SocialGoogleAccount([
        'provider_user_id' => $providerUser->getId(),
        'provider' => 'google'
      ]);
      $user = User::whereEmail($providerUser->getEmail())->first();
      if (!$user) {
        abort(response('Unauthorized', 401));
      }
      $account->user()->associate($user);
      $account->save();
      return $user;
    }
  }
}

The code now works but now the method name is not correct anymore createOrGetUser You can change this to getUserOrAbort for example in your SocialGoogleAccountService class and also update this in

public function callback(SocialGoogleAccountService $service)
    {
        try {
            $user = $service->createOrGetUser(Socialite::driver('googl.......
```

mvd left a reply on Sometimes View Doesnt Load Completely

Hi @danimohamadnejad

Did you check for errors in your internet browser console? Doest it work if you disable requirejs?

25 Aug
3 weeks ago

mvd left a reply on Translate Data With Database

Hi @khatran

Somthing like this, after submit the input save the translations

LanguageLine::create([
   'group' => 'menu',
   'key' => 'menu_labels',
   'text' => ['vi' => 'Trang chủ, Giới thiệu, Tin tức, Liên hệ', 'en' => 'Home, Introduce, News, Contact'],
]);

After clicking on the English flag, call this code

app()->setLocale('nl');

To print he English translation

trans('menu.menu_labels');
23 Aug
3 weeks ago

mvd left a reply on Translate Data With Database

@khatran if you run your code it will be stored in the database, it is not coming from the database.

But I am not sure, do you want to manually do the translation or are you looking a function todo the translation automatically for you?

mvd left a reply on Bug When Trying To View Laracasts Videos Or Discussions On Chrome

@safetyampdev

Works fine here on a Mac with Chrome Version 75.0.3770.142 (Official Build) (64-bit)

20 Aug
3 weeks ago

mvd left a reply on Sync To A Pivot Table

@marlonv

I think your $events = $request->get('events'); are not equal with $queues = $request->get('queues'); in number.

If a check box not is checked, then this checkbox is missing in the $request Example:

$events = array(1,2,4); // event with id 3 is not checked and does not exist in the request = count = 3
$queues = array(0,0,0,0); // count = 4
19 Aug
4 weeks ago

mvd left a reply on Build Laravel App With TDD Series 2 Testing Issue

Hi @nashan

The warning is pretty clear. Are there tests in file/class Tests\Feature\ProjectsTest ?

mvd left a reply on Translate Data With Database

Hi @khatran

Google translate is not always correct, I will not recommend that.

Can you use spatie / laravel-translation-loader? https://github.com/spatie/laravel-translation-loader/

How is your database structure? If it is just one field that needs translation you can add onother field with suffix '_en' for example

Other option is to modify the database. Example if you have a table post, move all the fields to a new table 'post_data' with fields like 'post id', 'language_id', other post fields. Now can add an entry for each language.

11 Aug
1 month ago

mvd left a reply on How To Update V-model On Select Tag With Value From Php ?

Hi @princeoo7

You need to pass the default select value to your component. Example:

<?php
$defaultValue  = 'local';
?>

<your-component-with-select img_loc="{{ $defaultValue }}"></your-component-with-select>

In your component:

props: ['img_loc'],

mvd left a reply on Communicating With Radio Buttons You Can't See In Your Script

Hi @harrisongreeves,

Everyone sees just 1 question, the (default) pagination functionlity does not use javascript so each step is a new page.

You could set a session or write the current results into the database after each answer submit Get this result with an ajax call to get result.

other option is to use a multi form with javascript, like https://github.com/BinarCode/vue-form-wizard or https://github.com/tushargugnani/vue-simple-form-wizard

10 Aug
1 month ago

mvd left a reply on Use Dusk In Console.php

Hi @nam_co,

$this-> does not work because you are not in a testcase. Created a quick example, this will help you

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Laravel\Dusk\Browser;


class Sreenshot extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'command:screenshot';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {

        $process = (new \Laravel\Dusk\Chrome\ChromeProcess)->toProcess();
        $process->start();
        $options = (new \Facebook\WebDriver\Chrome\ChromeOptions)->addArguments(['--disable-gpu', '--headless']);
        $capabilities = \Facebook\WebDriver\Remote\DesiredCapabilities::chrome()->setCapability(\Facebook\WebDriver\Chrome\ChromeOptions::CAPABILITY, $options);
        $driver = retry(5, function () use($capabilities) {
            return \Facebook\WebDriver\Remote\RemoteWebDriver::create('http://localhost:9515', $capabilities);}, 50);

        $browser = new Browser($driver);
        $browser->visit('https://laracasts.com/discuss/channels/laravel/use-dusk-in-consolephp');
        $browser->screenshot('laracast');
        $browser->quit();
        $process->stop();
    }
}
02 Aug
1 month ago

mvd left a reply on Calculate Dates

Hi @hjortur17

I am nor familiar with the v-calendar plugin but I think selectedValue.end and selectedValue.start are date objects?

if this is the case you can use Moment.js to calculate the days with the diff functionality, https://momentjs.com/docs/#/displaying/difference/

24 Jul
1 month ago

mvd left a reply on How To Add A Required Attribute To A Drop-down Menu With Jquery ?

@phoenix5

<select name="your_select_name">
    <option value="#">???</option>
    <option value="another_link">XX</option>
</select>

Also see, https://www.w3schools.com/tags/tag_select.asp

And if you want to submit the after a option is selected:

$('select[name="your_select_name"]').change(function() {
        this.form.submit();
    });

mvd left a reply on How To Add A Required Attribute To A Drop-down Menu With Jquery ?

Hi @phoenix5

Your dopdown is not a form field, required does not work on ul/li Use a <select>

Now you can use

if ($('input[name="radio_field_name"]:checked').val() == 1) {
 $('select[name="dropdown_field_name"]').attr('required', true);
}
22 Jul
1 month ago

mvd left a reply on HTML Name Attribute Vs Vue V-model

Hi @untymage

The name attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted.

https://www.w3schools.com/tags/att_form_name.asp

Or do you mean on a form input field?

If you add the name attribute on a input field you can access this field (value) in Laravel after submitting the form.

$request->input('name');

Or access this field with vanilla/other javascript libraries.

If there is no name on a form input field and only a v-model attribute the form will (most likely) then be submitted in Vue js (with Axios for example).

16 Jul
2 months ago

mvd left a reply on How To Showing Data On Blade With Pass Through 2 Table FK

@adhik13th it's hard to see what is wrong without code. Can you give us the relations (code) ?

mvd left a reply on How To Showing Data On Blade With Pass Through 2 Table FK

Hi @adhik13th

You pass the $practice variable/query result but in your view you use $riwayat

mvd left a reply on ES6 Features Like Arrow Function, Array.from() Not Working After Compiling Js Files With LaravelMix.

Hi @coachthem

Array.from is not supported in IE 11 (and earlier versions), got an older IE browser?

But this will help you.

Array.from() was added to the ECMA-262 standard in the 6th edition (ES2015); as such it may not be present in other implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Polyfill

10 Jul
2 months ago

mvd left a reply on How To Use Vars In *.vue Files From _variables.scss ?

@mstdmstd

Try this, replace

<style scoped>
    .element {
        color: $text-color;
    }

</style>

with:

<style lang="scss">
    @import "./resources/sass/_variables.scss";
    .element {
        color: $text-color;
    }

</style>

Does this work?

08 Jul
2 months ago

mvd left a reply on Seed Factory And Pivot Table

Hi @mostafalaravel

Do you have a factory created voor the groups ?

04 Jul
2 months ago

mvd left a reply on Problem With Running The Application From The Server With Debian 8.3

@pol_php I don't have much server experience but maybe this article will help you ?

Enable PHP 7.2 as Default

https://tecadmin.net/switch-between-multiple-php-version-on-debian/

mvd left a reply on Importing Node_Modules (Like FontAwesome)

@lordbedwetter np, i did this steps to use Font Awesome in a project. But does it not work?

mvd left a reply on Problem With Running The Application From The Server With Debian 8.3

Hi @pol_php

If I check this file and line I see

 return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null);

The ?? is available since PHP 7.0 so I guess there is also anotherPHP version (< 7) running. Can you check which PHP version is running? You can do this in the code, file public/index.php and on top

<?php
echo phpversion();
die;

Open the app and you will see the PHP version.

mvd left a reply on Importing Node_Modules (Like FontAwesome)

Hi @lordbedwetter

You can import the scss file into your scss files (resource/sass)

@import "node_modules/font-awesome/scss/font-awesome.scss";

And run

npm run dev
03 Jul
2 months ago

mvd left a reply on No Data Is Showing From Db

@incridible thanks and i see the 'problem'. Example file with id 1 is 'Aanzi Hajar_....' but the name (user, 3) is 'Hajar' so the name is not started with 'Aanzi' = no match.

If you don't only want to match on the beginning of the name you can remove the ^ in the check. Change it to:

@if (preg_match("/" . Auth::user()->name . "/", $file->filename))

mvd left a reply on No Data Is Showing From Db

Can you also post the filenames?

mvd left a reply on No Data Is Showing From Db

@incridible now you are check if the users emailadress is literally 'filename'

I think I see what you want to check, you want to check if the beginning of the filename is the username? Better approach is to do this:

<div class="form-group">
              <form oninput="this.submit()">
                <label class="text-left">Select Student</label>
                @auth()
                    <select name="Student" id="Student" style="padding: 5px; border-radius: 3px;">
                      <option value="">Select Student</option>
                      @foreach ($files as $file)
            @if (preg_match("/^" . Auth::user()->name . "/", $file->filename))
                      <option value="{{ $file->id }}">{{ $file->filename }}</option>
            @endif
                      @endforeach
                    </select>
                @endauth
              </form>
            </div>

mvd left a reply on No Data Is Showing From Db

@incridible what you are doing is checking if the name value in table users is filename but you don't have a (user) name filename. Only (Amin, Hajar, Abdelrahman, Saeed, Zakariya)

You can check this in your blade

{{ Auth::user()->name }}

(if you are loggedin)

mvd left a reply on No Data Is Showing From Db

@incridible thanks but you do a check if the name (column 'name' from table 'users') is literally filename, i think there is no user with the name 'filename'?

mvd left a reply on Do A Task For Users On A Much Lower Interval

@joveice that could be an option, with a cron job.

who can see the energy level? I f only a user can see his/her own energy level and users are not very active you could do

  • Log the timestamp when a user visit a page
  • On the next page request calculate the diff in seconds from the current timestamp with the logged timestamp and update the energy level.

mvd left a reply on No Data Is Showing From Db

@incridible you do a check for the username, @if (Auth::user()->name == 'filename') But i assume your uername is not really 'filename' ?

mvd left a reply on No Data Is Showing From Db

Can you give us the updated blade file?