ojthejuice

ojthejuice

Member Since 4 Years Ago

Experience Points
14,565
Total
Experience

435 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
173
Lessons
Completed
Best Reply Awards
0
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.

Level 3
14,565 XP
Jan
31
2 years ago
Activity icon

Started a new conversation 'Where' And 'How' To Save Images

So I have a site where user can upload images. Where and How should I save them. I mean I don't want just anybody(or some script kiddy) to be able to access them. I don't want to save them in a database either. I need ideas. So what is the standard.

Thanks

Apr
12
3 years ago
Activity icon

Replied to One Time Scripts With Access To App Namespaces

Still littering the forum with worthless comments, huh.

Activity icon

Replied to One Time Scripts With Access To App Namespaces

@willvincent, I see you don't get. So i'm going to say thanks for setting my expectations. I HAD NO idea there wasn't a easy button involved in the process. Now I would like to get back on topic. So I did create artisan command script and setup the remote cli configuration so that I can debug it. That works well. But it still don't answer the initial post. So, if anyone else would like to help. I'm welcome for suggestions. Even @willvincent, I would welcome any comment or suggestion you have also.

Activity icon

Replied to One Time Scripts With Access To App Namespaces

I know your trying to help, and i give you much thanks. But as I mentioned earlier. I was trying to avoid the command scripts. I believe trying to convince me to use them and giving a life lesson is uncalled for. Even the suggestion about using the command script was welcomed by myself. But the life comment I didn't take it well. I know I will have to do my bit of research also, I posted here. Because I thought someone else my have experienced it, and it would be quicker. That's it. I'm not here for smart rhetorical comments like so many tech forums are littered with. I have been impressed by the comments and help given in forum. And I would like it stay that way. That uncalled for comment of mine, was kinda of me saying "Please Leave, Take that garbage elsewhere"

Activity icon

Replied to One Time Scripts With Access To App Namespaces

NO, It sounds like. I wanted to do it a way YOU ALSO don't know how to do it. If you don't know, you don't know. I posted this for help. I really appreciate your comments but the last one was unnecessary.

Activity icon

Replied to One Time Scripts With Access To App Namespaces

Yeah, i was trying to avoid all of that. I had the most trouble setting that stuff up with: different phpstorm, php versions, and different environments. Its just a hassle. I really wanted to find out a way to do one off scripts, setup a debug configuration in phpstorm and done with it. I have another idea that knowing this would be handy down the road. Thanks, I guess the command script will have to work for now.

Activity icon

Replied to One Time Scripts With Access To App Namespaces

But how do I debug it. I created an artisan command the other day. I like it but, honestly I dont know how to debug it. That probably a simple question, lol.

I guess i could debug artisan and set breakpoints in the command script.

Activity icon

Replied to One Time Scripts With Access To App Namespaces

Yeah, homestead. I cut the code and put it in a controller and setup a route and it works fine. ran it from a browser it works fine.

Activity icon

Replied to One Time Scripts With Access To App Namespaces

Can I do something like a composer update or optimize or reload or something. kind of new to composer.

Activity icon

Replied to One Time Scripts With Access To App Namespaces

<?php
require dirname(__DIR__) . '/vendor/autoload.php';
require dirname(__DIR__) . '/bootstrap/app.php';

use MyApp\Meal\Description as Description;

class PopulateMealDescriptions
{
    private $generalFoods = [
        'asparagus',
        'apples',
        'Zucchini',
    ];

    public function __construct()
    {

    }

    public function addGeneralFoods() {
        foreach($this->generalFoods as $food) {
            $description = Description::where('description', '=', $food)->first();
            if ($description != null) {
               $description->description = ucfirst($food);
            } else {
                Description::create(['description' => $food]);
            }
        }
    }
}

$job = new PopulateMealDescriptions();
$job->addGeneralFoods();

Error

/usr/local/php5-5.5.15-20140809-134316/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /Users/James/...MyApp/bin/PopulateMealDescriptionsTable.php
PHP Fatal error:  Call to a member function connection() on a non-object in /Users/James/...../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 3224

PHP Stack trace:
PHP   1. {main}() /Users/James/....bin/PopulateMealDescriptionsTable.php:0
Fatal error: Call to a member function connection() on a non-object in /Users/James/..../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 3224
PHP   2. PopulateMealDescriptions->addGeneralFoods() /Users/James/..../bin/PopulateMealDescriptionsTable.php:159

Call Stack:
PHP   3. MyApp\Meal\Description::where(*uninitialized*, *uninitialized*, *uninitialized*) /Users/James/.../bin/PopulateMealDescriptionsTable.php:148
.
.
.
PHP  12. Illuminate\Database\Eloquent\Model::resolveConnection($connection = *uninitialized*) /Users/James/.../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3190
    0.1383    3508112  12. Illuminate\Database\Eloquent\Model::resolveConnection(???) /Users/James/.../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3190


Process finished with exit code 255

Activity icon

Replied to One Time Scripts With Access To App Namespaces

I created a ProjectRoot/bin/ScriptName.php. And inside in removed namespace and put

require dirname(__DIR__) . '/vendor/autoload.php';
require dirname(__DIR__) . '/bootstrap/app.php';

sames error as above

Okay this is what I have, and I get a PHP Fatal error: Call to a member function connection() on a non-object in .../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 3224 . . . . PHP 12. Illuminate\Database\Eloquent\Model::resolveConnection($connection = uninitialized) .../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3190

Activity icon

Replied to One Time Scripts With Access To App Namespaces

The script is not in the root directory. Im I missing something. Does the order matter?

Apr
11
3 years ago
Activity icon

Replied to One Time Scripts With Access To App Namespaces

I have a folder in the app dir. The full path is app/Application_Helpers/Foo/FooBar/NameOfScript.php

Activity icon

Replied to One Time Scripts With Access To App Namespaces

Note: Using a homestead environment.

My Thoughts: Seems as if the db connection is null.

Okay this is what I have, and I get a PHP Fatal error: Call to a member function connection() on a non-object in .../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 3224 . . . . PHP 12. Illuminate\Database\Eloquent\Model::resolveConnection($connection = uninitialized) .../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3190

<?php
namespace PATH\TO\MY\SCRIPT;

require dirname(__FILE__) . '../../../../bootstrap/app.php';
require dirname(__FILE__) . '../../../../vendor/autoload.php';

use PATH\TO\DESCRIPTION as Description;

class NameOfScript
{
    private $array = [
        'value',
    .
    .
    .
    ];

    public function addGeneralInformation() {
        foreach($this->$array as $data) {
            $description = Description::where('description', '=', $data)->first();
            if ($description != null) {
               $description->description = ucwords($data);
            } else {
                Description::create(['description' => $data]);
            }
        }
    }
}

$job = new NameOfScript();
$job->addGeneralInformation();
Activity icon

Started a new conversation One Time Scripts With Access To App Namespaces

Can someone please advise how to create and on time script that has access to all namespaces in my app. I dont want to use artisan console commands. Just a "php myscript.php". I also want to be able to debug it in phpstorm.

Aug
20
4 years ago
Activity icon

Replied to Set Input Directory For Less Function

I tried that solution and I dont think that works. I edited the less.js file and here was my solution.

start on line 36

/**
 * Prep the Gulp src and output paths.
 *
 * @param  {string|array} src
 * @param  {string|null}  output
 * @return {object}
 */
var prepGulpPaths = function(src, output) {
    //My Hack: if source is directory use it if not use default
    var directory = '';
    if (src.indexOf('/') > -1){
        directory = src.substring(0, src.lastIndexOf('/') + 1);
    } else {
        directory = config.get('assets.css.less.folder');
    }
    return new Elixir.GulpPaths()
        .src(src, directory)
        .output(output || config.get('public.css.outputFolder'), 'app.css');
};

That way i can run this in Gulpfile

//task one
    mix.less(
        'style.less',                    //Less file created in public/css/app.css
        'public/frontend-less/style.css' //Specifies where the combined less file will go
    );

//task two
    mix.less(
        'resources/admin/less/style.less',
        'public/admin/less/style.css'  //Less file created in public/css/app.css
    );
Activity icon

Started a new conversation Set Input Directory For Less Function

Is there a way to set the input or root directory for less using elixir. And can i use mix.less twice. i.e

elixir(function(mix) {
    mix.less(
        'style.less',                                  
        'public/frontend-less/style.css' 
    );

   //second less task 
    mix.less(
        '..',                    //point to different directory
        '....'                   //output to different directory 
    );

});
Aug
05
4 years ago
Activity icon

Started a new conversation Creating Helper Classes And Functions That I Can Use In The Controller Or Model.

What is the best place or practice to create helper classes/function so I can use them in the controller layer?