w1n78

Member Since 5 Years Ago

Experience Points 25,915
Experience Level 6

4,085 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 46
Lessons
Completed
Best Reply Awards 30
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.

06 Mar
2 months ago

w1n78 started a new conversation Need Help With Vue-search-select And Json Data

i'm using vue 2.5.7, vue-search-select 2.8.3, laravel 5.7. i have a json generated from a url on the same domain at /occupations/search-select with the following data format

{
  "data": [
    {
      "id": 98,
      "name": "Accountants"
    },
    {
      "id": 97,
      "name": "Accountants and Auditors"
    },
    {
      "id": 388,
      "name": "Actors"
    }
]
}

next i have a SearchSelectOccupationsComponent.vue file with the following code

<template>
    <model-select :options="options"
                    v-model="item"
                    placeholder="select item">
    </model-select>
</template>

<script>
    import { ModelSelect } from 'vue-search-select'

    export default {
        name: 'search-select-occupations',
        data () {
            return {
                options: [
                    {value: '1', text: 'aa' + ' - ' + '1'},
                    {value: '2', text: 'ab' + ' - ' + '2'},
                    {value: '3', text: 'bc' + ' - ' + '3'},
                    {value: '4', text: 'cd' + ' - ' + '4'},
                    {value: '5', text: 'de' + ' - ' + '5'}
                ],
                item: {
                    value: '',
                    text: ''
                }
            }
        },
        methods: {
            reset() {
                this.item = {}
            },
        },
        mounted () {
            $.getJSON('/occupations/search-select', json => {
                this.occupations = json.data
                console.log(json.data)
            })
        },
        components: {
            ModelSelect
        }
    }
</script>

i'm able to get the dropdown to display what is currently in the data(). but how do i change that to use the json produced by /occupations/search-select?

i think i'm almost there i just don't know the next step. the console.log does display the json data. can someone help? i'm horrible at front-end.

14 Feb
3 months ago

w1n78 left a reply on Best Way To Backup MySQL Database From Laravel Forge Production Server?

@SKCIN7 - i know this is an old post but i just wanted to note that on the script, you are storing your sql file in /var/www/mywebsite.com/mysql_backups directory. i'm assuming this is where you website is. but i'm also assuming that if i were to go to http://mywebsite.com/mysql_backups/2019-02-14.sql (or something like that) i will be able to get access to your sql file. so i hope this is not what you're doing still or i hope people did not copy and paste and used a similar path.

just wanted to reply since i just ran in to this post and hope that no one is using a location that is publicly accessible.

03 Feb
1 year ago

w1n78 left a reply on Class Name Class?

@Shahrukh4 @bobbybouwmann thank you.

i'll keep it as is. i think the IDE is set to be sensitive by default. right now i'm just building models and seeders. i'm moving data from mssql to mysql as an experiment project.

i won't know if it becomes an issue until i write tests. if it does fail, i'll just refactor that model. luckily the relationship only exists in 2 other models. i just want to get the data over and play with it in laravel - cleaning things up in the process.

w1n78 started a new conversation Class Name Class?

i use phpstorm as an IDE. i have a model named class that contains information about classes as in school classes. so i would think to use class as the name of the class. the IDE reports it as a possible error. before moving forward would it be an error?

// Class model
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Class extends Model
{
    protected $table = 'classes';

    /**
     * Class belongs to program type.
     * @return mixed
     */
    public function programType()
    {
        return $this->belongsTo(ProgramType::class);
    }
}

// Program Types model
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ProgramType extends Model
{
    protected $table = 'program_types';
    public $timestamps = false;

    /**
     * Program type has many classes.
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function classes()
    {
        return $this->hasMany(Class::class);
    }
}

i think i ran into something similar with a model called Event but it worked out alright.

if this doesn't work, should i use a different name - what name? or use the plural?

31 Jan
1 year ago

w1n78 left a reply on Summernote "global" Settings?

so changing the id to class name worked. here's what i ended up having

// app.js

$('.my-summernote').summernote(
    {
        toolbar: [
            // [groupName, [list of button]]
            ['style', ['bold', 'italic', 'underline', 'clear']],
            ['font', ['strikethrough', 'superscript', 'subscript']],
            ['fontsize', ['fontsize']],
            ['color', ['color']],
            ['para', ['ul', 'ol', 'paragraph']],
            ['height', ['height']]
        ], height: 200
    }
);

then i run npm run dev

in my view files i can do the following

<div class="my-summernote" id="summernote1"></div>

<div class="my-summernote" id="summernote2"></div>

as long as i use the css class name, it will apply what i defined in app.js throughout the app.

30 Jan
1 year ago

w1n78 left a reply on Summernote "global" Settings?

@bobbybouwmann it works if i use "summernote" as the id. but i was hoping to have it apply to all summernote regardless of the value of id.

i wonder if i use a class name instead something like my-summernote then use

$('.my-summernote').summernote(
{
  my code from above
}
);

then on my view...

<div class="my-summernote" id="summernote1"></div>

<div class="my-summernote" id="summernote2"></div>

w1n78 left a reply on Can't See My New Project On Domain Or Localhost IP

seems that you have but, have you edited your hosts file C:\Windows\System32\drivers\etc. you will need to be admin to edit this

also with chrome you need to do a trailing / so if the url is http://myproject.test/ - don't forget the trailing /... https://webdevstudios.com/2017/12/12/google-chrome-63/

those are my initial guesses. hope that helps

w1n78 started a new conversation Summernote "global" Settings?

how do i make it so that all instances of summernote have a height of 200? also, i want specific options showing up in the toolbar.

in my app.js file i have the following code at the bottom

$('#summernote').summernote(
    {
        toolbar: [
            // [groupName, [list of button]]
            ['style', ['bold', 'italic', 'underline', 'clear']],
            ['font', ['strikethrough', 'superscript', 'subscript']],
            ['fontsize', ['fontsize']],
            ['color', ['color']],
            ['para', ['ul', 'ol', 'paragraph']],
            ['height', ['height']]
        ], height: 200
    }
);

i run npm run dev no errors but it's not working. i'm sure my implementation is wrong. i just don't want to have to define this on every summernote textarea. is it possible?

23 Jan
1 year ago

w1n78 left a reply on Artisan Tables - How Can I Make Them Not Drop To The Next Line?

i usually just make my window wider :)

19 Jan
1 year ago

w1n78 left a reply on SWITCH TO LINUX

@cronix no, i vagrant ssh and do everything there. i believe it has something to do with permissions when the folders on windows and ubuntu try to sync. i get errors related to permissions where it can't delete something. i've tried --no-bin-links and several other things, just a headache from my experience.

i've taken the same project to macos with homestead and it runs fine. i've tried a different pc and i get the same error result. the weird thing is php artisan runs fine even if it does folder/file manipulation. i can't pin point what the issue is.

windows and homestead hasn't worked out for me and the time i spent troubleshooting was way more than i wanted.

w1n78 left a reply on SWITCH TO LINUX

i have had many issues using homestead in windows relating to node, npm, webpack, etc. so many hours lost.

if you have pc hardware, try and use ubuntu a dev environment or on windows use a vm and run ubuntu - though it's painful on a vm. if you can get access to macos, that works too.

if you have windows server for production then keep windows. i have wasted so many hours just trying to make windows work as a dev environment. if i were a freelance developer, that potentially be a lot of money - more than a macbook pro. fortunately, i have access to apple hardware and i have spare pc i can run linux on.

17 Jan
1 year ago

w1n78 left a reply on Laravel 5.5 Return Back To Registration Form If Conditions Is Not Met

have you dd($access) to see what it's really returning?

place it before

if (!$access)

w1n78 left a reply on Laravel 5.5 Return Back To Registration Form If Conditions Is Not Met

do you need help with code or do you need help with the code you wrote? if you have code, can you share please?

usually i use

return back()->withInput()->with('error', 'There was an error...');

that usually only gets triggered if validation passes but there's an issue with the database entry/update.

with validation, it "should" automatically handle the redirect.

w1n78 left a reply on How To Store Complex Dates In Mysql

@devTriple i just realized i have something similar but not as complicated in one of the apps i built. i have built an app that tracks my sneaker collection. in my shoe table i have 2 columns - release_year and release_date. the reason i have this is i can't find information on some shoes of their release date, sometimes i can only find a year. so release_year is a small integer column that takes year values. release_date column is a date field. both are nullable. i created model accessor where it displays one or the other and makes release_date higher priority if the record has both.

so i'm thinking you could make columns in the table for each date type. i would then use regular expression to do validation to make sure the data going in is what is expected.

now as far as querying, you may have to do some select case statements. i would probably go with stored procedures to ease off the web server resources.

i'm not sure if this would work but just wanted to share an idea.

w1n78 left a reply on How To Store Complex Dates In Mysql

oh, he actually wanted ? question marks as part of the value he wants to store. i thought they were just placeholders like blah blah blah lol. my bad

w1n78 left a reply on Laravel Default Integrated Auth System

You don’t have to use Laravel auth. You can build your own from scratch or use a package. The auth scaffold is not installed/used by default unless you run the make:auth command in terminal. Is that what you’re referring to?

w1n78 left a reply on How To Store Complex Dates In Mysql

I would use datetime column. If you store just a date and no time it will have y-m-d 00:00:00. If you need to compare, there are functions in MySQL to calculate or compare dates. On the application you can use carbon.

If you need just date with no time, you can use the date column.

Datetime supports dates from the year 1000 https://dev.mysql.com/doc/refman/5.7/en/datetime.html

I hope I understood your question.

w1n78 started a new conversation Relationship With() Using Date Field Not Id?

I have a bonus_periods table with a start_date and end_date columns. I have an incidents table with an incident_date column. I’d like to create bonus_periods has many incidents and vice versa where incidents.incident_date is between bonus_periods.start_date and bonus_periods.end_date.

I know how to do it with join and I can do it with nested foreach but can it be defined so I can use with()?

08 Jan
1 year ago

w1n78 left a reply on Laravel 5.4 How To Get $id After Form Submit

if you do $file->save you should be able to call $file->id and it will give you the last insert id for the File model.

w1n78 left a reply on Migrate

the error is providing you the info - it can't find the driver. you haven't given much info to your environment.

what OS are you running? which database are your running mysql/mariadb, mssql server, sqlite?

i'm guessing you're on a windows OS using mssql server or mysql. you have to install the database driver. otherwise, it doesn't know how to connect to the db.

w1n78 left a reply on Expected Response Code 250 But Got Code "530", With Message "530 5.7.1 Authentication Required "

i used gmail as smtp a while back. if i remember correctly, i created an app password and used that credentials and it worked https://support.google.com/accounts/answer/185833?hl=en

w1n78 left a reply on Upload Laravel Project To CPanel And Connect With Phpmyadmin

@minhankyaw if you must use a shared host, check out this article https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e

i don't have much experience with it but i did a quick google and that's what i came up with. be very careful. it can expose certain files if you put the entire project in public_html or www such as your env file.

i see many posts regarding this and i'm not sure why. but you're a dev. get your hands dirty and learn a bit of server infrastructure. learn how to fire up a VPS. if not, use laravel forge - it'll save you time and headache. it cost more money but sometimes you gotta spend money to make money. just my opinion.

16 Dec
1 year ago

w1n78 left a reply on Auth Attempt == False But Hash Check == True?

so i did more digging. i overwrote resetPassword($user, $password) in App\Http\Controllers\Auth\ResetPasswordController

protected function resetPassword($user, $password)
    {
        //$user->password = Hash::make($password);
        $hashed_password = Hash::make($password);
        $user->password = $hashed_password;

        if (Hash::check($password, $user->password))
        {
            dd('true');
        }

        dd('false');

        $user->setRememberToken(Str::random(60));

        //$user->save();

        //event(new PasswordReset($user));

        //$this->guard()->login($user);
    }

here's some more testing

Hash::check($password, $user->password) // returns false

Hash::check($password, $hashed_password) // returns true

what am i missing here? it was working before

w1n78 left a reply on Beginner Question Re. Relationships (Team, TeamMember, User)

@kvnkrft glad i could help :) i'd drink another but i'm pulling my hair out on a password issue that i hope someone in this forum can help.

w1n78 left a reply on Beginner Question Re. Relationships (Team, TeamMember, User)

@kvnkrft belongsTo() is an inverse of one to many https://laravel.com/docs/5.5/eloquent-relationships#one-to-many-inverse

a user can be in more than one team a team can have more than one user

i'm running through your model in my head but something seems to be missing or can be handled differently. although it's late here and i had some beer earlier haha. hope i'm not steering you in the wrong direction. but generally that's how i handle pivoting

15 Dec
1 year ago

w1n78 left a reply on Beginner Question Re. Relationships (Team, TeamMember, User)

assuming team_members table is something like... id user_id team_id

// User model

public function teamMembers()
{
    return $this->hasMany(TeamMember::class);
}

// Team model

public function teamMembers()
{
    return $this->hasMany(TeamMember::class);
}

// TeamMember model
public function team()
{
    return $this->belongsTo(Team::class);
}

public function user()
{
    return $this->belongsTo(User::class);
}

w1n78 started a new conversation Auth Attempt == False But Hash Check == True?

i'm not sure why this is happening but i did a quick test in a route closure

Route::get('test3', function()
{
    $email = '[email protected]';
    $password = 'pass123';
    $credentials = ['email' => $email, 'password' => $password];

    $attempt_result =  Auth::attempt($credentials);
    $len_result = strlen(Hash::make($password));
    $hash_check_result = Hash::check($password, Hash::make($password));

    dd ($attempt_result, $len_result, $hash_check_result);

});

this returns false, 60, true. i checked the table size and it's 255. it's UTF-8 unicode encoding and utf8mb4_unicode_ci for collation.

another weird thing is if i run through password reset, i can reset the password and it auto logs me in once i give it a new password. but when i log out then log back in, it tells me invalid credentials. this was working this morning. any ideas?

14 Dec
1 year ago

w1n78 left a reply on Can I Force Images To Be Square?

@Cronix oh cool. thanks i'll check it out.

w1n78 started a new conversation Can I Force Images To Be Square?

is there something i can use to make images that are uploaded to be square. for instance, i want all images to be 800x800. i'd like the user to be able to select a section of the image and have it cropped or resize to fit the square. kind of like how instagram does it.

i am using image intervention to do the resizing and orientation fix already. but those who upload a photo that is landscape or portrait and not square, it resizes the images and crops them to make it square. hope i'm explaining this right.

w1n78 left a reply on Complex DB Query

haha i started to write it out but got a headache. but here is how i would approach it. it's a very rough draft but i hope it gives you an idea of what you can do. essentially, you can use closures to chain them. hope that helps.

Project::where(function($query) use($start_month, $end_month) {
    $query->where(function($query2) use($start_month, $end_month) {
        $query2->where('start_ts', '<=', $start_month)
            ->orWhere('start_ts', 'BETWEEN', $start_month...);
    };
})
->where('cat_id', 1)->get();
09 Dec
1 year ago

w1n78 left a reply on Redirect To Previous Page Exclude Login Page

" after I sign up, the system should redirect me back to the checkout page."

so all you want is to redirect the user to the checkout page after a successful sign up?

here are different ways to redirect aside from back()

return redirect()->to('my-checkout-page');
return redirect()->route('checkoutRouteName');
return redirect()->action('[email protected]');

30 Nov
1 year ago

w1n78 left a reply on Action Method Of A Controller In Laravel 5.5

did you define it in your routes file?

29 Nov
1 year ago

w1n78 left a reply on $ Inside An @if

@SeroS try and add \ or \. can't remember which one but it will escape it and make it a string $

28 Nov
1 year ago

w1n78 left a reply on How To Use Session In Custom Facade In Laravel 5.5

@dhiru027 by default, the session driver is set to file. it's possible that permissions may not be allowing to write to this file? just a guess.

w1n78 left a reply on New To Laravel, Cannot Find A Page

@dan3460 i'm not as familiar with apache2 anymore. i've been spoiled by laravel forge on my production servers. for dev environment, i usually just use the built-in web server that comes with php and it works right out the box.

so the .htaccess that comes w/ laravel doesn't work with the apache2 default config?

w1n78 left a reply on New To Laravel, Cannot Find A Page

i have a feeling it's related to rewrite rules in your .htaccess.

trying testweb1/index.php/about

if this loads, it's not rewriting the url correctly. just a guess

w1n78 left a reply on Get Record Sorted By Created_at (time) In Pivot Table

@tsaicharlie93 try using a closure with with()

https://laravel.com/docs/5.5/eloquent-relationships#constraining-eager-loads

$results = User::with(['departmentSites' => function($query) {
    $query->orderBy('time_record_column_name');
}])->get();

w1n78 left a reply on Netflix

@seansan apple tv is limited to macOS or iOS i believe and uses airplay. on macOS it's limited to quicktime and safari browser - https://support.apple.com/en-us/HT201343

on iOS https://support.apple.com/en-us/HT204289

w1n78 left a reply on How To Use Left Join In Eloquent

okay i played with it more. in laravel 5.5 with() actually works for me

so my situation is as follows

a shoe hasMany() shoe_images shoe_images belongsTo() a shoe

// model
$shoe = Shoe::with('shoeImages')->get();

// view
// if shoeImages relationship exist, display random image
@if ($shoe->shoeImages->count())
    <img src="{{ $shoe->shoeImages->random()->filename }}">
@else
    <img src="/images/stock_image.jpg">
@endif 

w1n78 left a reply on What Are The @(something) In Comments?

@475513a it's a php thing for documentation. please check out this page for reference http://docs.phpdoc.org/references/phpdoc/tags/index.html

w1n78 left a reply on How To Use Left Join In Eloquent

@jekinney i tried has() and it's not doing a left join in laravel 5.5

is scope the only option?

i have a hasMany relationship i'm trying to do a inRandomOrder() but only if it exists. but i want the records to display even if the relationship doesn't exist.

sorry to bring an old topic back to life but i didn't want to post a new topic. seems my question is relevant to this, no?

17 Nov
1 year ago

w1n78 left a reply on How To Make Js Work On Laravel 5.4?

@dildo_beggins

if you do a view source in your web page, what is the value that asset() is parsing out?

09 Nov
1 year ago

w1n78 left a reply on Advise About Gridview Controller

@FernandoD

i hope i understood your question. what i use are partial views. for instance, let's say i have an index page that displays user info in a data grid as follows

username | email | first name | last name|

i also have a search/result user interface. instead of creating 2 separate views for index page (display all users) and user search result page (displays the same thing but with filters), i use partial view for the data grid. hope that makes sense.

06 Nov
1 year ago

w1n78 left a reply on Migration To Create A New Expiry Column With The Default Date One Year From Now

@cvanderlinden

i would do it during the record creation and/or update using carbon

$expire_date = Carbon::now()->addyear();

where $expire_date takes the current datetime value and adds a year. i haven't tried the code but it may spit out a different format not matching the database column but you can use carbon to set the format as well.

05 Nov
1 year ago

w1n78 left a reply on Can't Connect To Database ! ?

@roger2014jr does ellissto_forum user exist as a database user? if so, does it have correct privileges for the database you are trying to connect to? not the server but the database itself?

02 Nov
1 year ago

w1n78 left a reply on How To Create Separate Registrations For Two Types Of Users.

do you want to relate the role to the user record or the project? for instance, a user can only be an owner or a contributor. or do you want it where a user can be an owner of a project but contributor to other projects? that's where i would start. can a project have more than one owner? with the information you provided, those are the questions that come to my mind.

if it's the first, you can have a relationship like "a role has many users" and "a user belongs to a role".

if it's the latter, then you can have a pivot table that has role_id, user_id, and project_id.