SapporoGuy

Experience

7,400

2 Best Reply Awards

  • Member Since 2 Months Ago
  • 60 Lessons Completed
  • 0 Favorites

17th January, 2018

SapporoGuy left a reply on Laravel CMS • 1 hour ago

October seems very symfony so I never kept with it after their release.

Statmic if not mistaken is flat file so I didn't bother following up on it.

Pyro has streams or whatever they call them and found them confusing.

check out Coaster. It has a funky modx style of variables and it isn't a bad october/pyro style of system.

Asgard ... I go back and forth on this one. It has a lot going for it but I still think the dev is over complicating things.

SapporoGuy left a reply on Laravel 5.4 - Get Translations From Database Instead Of Lang Files • 1 hour ago

I used a modified settings package back in L4.x. You should also consider caching the inital db call to make this faster too.

I used to be real big on this type of functionality until I realized that language files just don't change that often.

Are you planning to let people do their own translations?

SapporoGuy left a reply on How To Store Complex Dates In Mysql • 3 hours ago

Just gonna throw out a dumb suggestion, but why not store them as unix epochs? Obviously lots of conversions will need to be done but storing the date-time will be unified.

posted: 1516218606

SapporoGuy left a reply on Dusk: How Can I Do A Search And Check For A Value Returned From Datatables (yajara) • 7 hours ago

I am not sure what went on here but this is how I solved it.

                    ->waitForText('Search')
                    ->type('input.form-control.input-sm', $default_category_name)
                    ->waitForText('Showing')
                    ->assertSeeLink($default_category_name);

for some reason I needed to declare the class since dusk was not seeing the search type.

16th January, 2018

SapporoGuy started a new conversation Scout + Algolia But Not Elastic. Why Is That? • 1 day ago

I was wondering why Laravel documentation provides information for algolia but not elastic. Is this just because it's a lot easier to implement and pass along services to these companies or is this a minor revenue stream that is helping out laracasts and Taylor?

15th January, 2018

SapporoGuy started a new conversation VSTS For Deployment • 2 days ago

I was wondering if anybody has used VSTS for their build process and if anybody has seen a laravel specific article on it?

11th January, 2018

SapporoGuy started a new conversation Dusk: How Can I Do A Search And Check For A Value Returned From Datatables (yajara) • 6 days ago

Here is what I have tried so far

                    ->waitForText('Search')
                    ->type('search', $default_category_name)
                    ->assertInputValue('search', '')
                    ->assertSee($default_category_name);

But would get a textarea error ... wth?

                    ->waitForText('Search')
                    ->script('window.scrollTo(0,document.body.scrollHeight);')
                    ->waitForText('Last')
                    ->click('#data-table-default-category_last')
//                    ->clickLink('Last')
                    ->assertSee($default_category_name);

But would get an array error.

What I am trying to do is a search on a datatables data.

also, why doesn't dusk/phpunit know that a page is actually beyond the resolution (meaning it needs to scroll)?

Thanks

8th January, 2018

SapporoGuy left a reply on Which Course To Choose? • 1 week ago

Why not watch vue1 without doing the code and then watch vue2 as you would normally study?

14th November, 2017

SapporoGuy left a reply on Help With Spatie/Permissions (and Maybe Redis) • 2 months ago

That's just weird.

try this package: https://github.com/rappasoft/laravel-5-boilerplate/tree/feature/5.5

I am lazy so I just normally start with that boiler plate.

SapporoGuy left a reply on Authenticate A Device Rather Then A User • 2 months ago

Theoretically, it should be the same as doing this by login/password.

I haven't done this yet but I would possibly use the device ID and then pass the ID for login and hash the ID for the password. Then I would break it out properly into it's own guard once I knew it would work. I am guessing but you might have to disable the default guard to do what you want.

Sorry for all the guess work but I didn't want to see your post go empty. This happens to me a lot.

Just out of curiosity. How are you grabbing the device ID?

9th November, 2017

SapporoGuy left a reply on How To Insert A Csv File Database That Contains Thousands Of Lines In The Laravel Seeder Without Typing It Value After Value • 2 months ago

I normally do this with a seed command because I often get CSV files to update 100s of entries.

Here is a very basic way that I do this:


public function run()
{

// users
// clear out the current table to add new data and reset the increment count to 1

    DB::table('users')->delete();
    $statement = "ALTER TABLE users AUTO_INCREMENT = 1;";
    DB::unprepared($statement);

    $csv = dirname(__FILE__) . '/data/' . 'users.csv';
    $file_handle = fopen($csv, "r");

    echo PHP_EOL;
    echo '------------------------------------------ open file ------------------------------------------';
    echo PHP_EOL;

    while (!feof($file_handle)) {

        $line = fgetcsv($file_handle);
        if (empty($line)) {
            continue; // skip blank lines
        }
        if ($line[0] == 'ID') {
            continue; // skip column headers
        }

/*
CSV column names
0 ... ID
1 ... NAME
2 ... NUMBER
3 ... NOTES
*/

            $insert = array();
            $insert['name'] = $line[1];
            $insert['number'] = $line[2];
            $insert['notes'] = $line[3];

// insert
            DB::table('users')->insert($insert);

            echo 'insert: ' . $line[1] ;
            echo PHP_EOL;

        }

    }

    fclose($file_handle);

    echo PHP_EOL;
    echo '------------------------------------------ close file ------------------------------------------';
    echo PHP_EOL;

} // run

Obviously you could update this to run checks on data or do what ever else you want to it.

I echo lines so that I can monitor the output in the terminal to catch any errors or logic problems in my code.

8th November, 2017

SapporoGuy left a reply on Controller Questions • 2 months ago

@ejdelmonico did a good job explaining this but I will try to make it more simple.

  1. Yes. "Article" here is the name of the model.

  2. No.

compact('articles') is the variable from this line

$articles = Article::latest()->paginate(5);

Bascially, "compact('articles') is just saying to pass the variable $articles to the template.

view('articles.index',compact('articles'))

So you pass the variable $articles to the template located at resources/views/articles/index.

"view('articles.index'," uses dot notation which would be the '/articles/index" I just mentioned.

You were sort of close. When you asked about routes. But actually it was the location to the templates.

Route::resource('articles','ArticlesController');

here the 'articles' is part of the URL: http;//mywebsite.com/articles

ArticlesController should be self explanatory.

SapporoGuy left a reply on Test • 2 months ago

Q: Why did the did the programmer using Eloquent leave his wife?

A: She had one-to-many relationships

7th November, 2017

SapporoGuy left a reply on Website In Subdirectory/location (nginx) • 2 months ago

I don't use ngnix but my guess is going to be the like:

root /var/www;

I probably would write it as:

root /var/www/sub_directory/your_laravel_project_name;

To be more answer friendly:

root /var/www/ClientA/LaravelCMS;

That is if you have several projects for a Client. If not just put your laravel code within the ClientA directory.

SapporoGuy left a reply on User Assigning With Role/Permission With Respect To Plant • 2 months ago

You could possibly assign roles according to that company's corporate structure. Then those roles would given certain permissions according to business logic,

SapporoGuy left a reply on Is There A Way Remove Index.php In Laravel Without Changing .htaccess • 2 months ago

Have them add it directly to the server config file.

Basically, my minor understanding to shut off htaccess to users is to prevent dumb people doing dumb things like screwing up the redirect to create loops. The biggest security issue I can think of is using the htaccess to point to dangerous files. But ... in this case, the hosting company already has trouble because ftp access has been gotten and a lot more could happen.

,Anyway, get them to add it to the config file directly which is actually the best way to do this.

SapporoGuy started a new conversation Clean Coding Standards Check Technologies? What Would You Recommend? • 2 months ago

Having finally switched to 5.5 I also want to switch to code review standards and noticed StyleCI but also was wondering what other services are out there that I should look at or implement. My goal is to finally start making my code cleaner over a long haul project. I noticed that a lot of my 5.1 code with more features and tight timelines ends up looking sloppy so I figured that with the new 5.5 release I would put myself on a regiment to prevent my bad habits.

SapporoGuy left a reply on Action Log • 2 months ago

Take a look at Spatie's log package. https://github.com/spatie/laravel-activitylog

Or just look into Laravel's log function. It's simple but works.

Here is a boiler plate that has implemented this: https://github.com/rappasoft/laravel-5-boilerplate/tree/feature/5.5

Don't reinvent the wheel, unless you have to ;-)

6th November, 2017

SapporoGuy left a reply on Database Design Choice • 2 months ago

Yes and No. It all depends on what kind of information you are planning to store. You could just go with groups or even an extra column in the user table like "user_type".

My gut feeling on this particular case is to don't use an extra teacher's table and just use the user_id / teacher_id situation like @jontyjago suggested.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.