Riotsmurf

Experience

790

0 Best Reply Awards

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

27th June, 2017

Riotsmurf left a reply on SMTP Mail Fail • 1 month ago

If you don't get the solution, i recommend switching to mailgun.

Riotsmurf started a new conversation Validation Of An Array And Custom Message. Help Me! • 1 month ago

I want to validate an array of emails and then tell the user which of those emails failed the validation.

How would i grab the index of the failed email? I tried something like this: but failed(I knew it would)

private function validator($data)
    {
        $rules = [
              'custom' => [
                'to.*' =>[
                  'email' => $data['to']['*'] . " is not a valid email.",
                  'required' => "This requires an email address to send."
                ],
                'bcc.*' => [
                  'email' => $data['bcc']['*'] . " is not a valid email."
                ],
              ],
              'content' => 'min:4',
          ];

          return Validator::make($data, $rules);
    }

I want to know how i can get the index where the little * is in $data['bcc'] and $data['to'].

If i have to make a custom validator that loops through and validates each email individually then fine, but i would like something short and easy here if possible.

15th June, 2017

Riotsmurf left a reply on Lumen Not Seeing Js Folder/files In Public. But Can See Css. • 2 months ago

RaphaelBronsveld: Omfg. My brain is dead. Thanks! I cannot believe i did that.

Riotsmurf started a new conversation Lumen Not Seeing Js Folder/files In Public. But Can See Css. • 2 months ago

I have a public folder with css and js folders in it. Inside the css folder is a bulma.css file. In the js folder there is a searchInit.js file. When i try to bring these in via link/script tags it just ignores the js ones.

My html looks like this:

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>{{ config('app.name', 'Conan: ') }} @yield('title')</title>

    <!-- Styles -->
    <link href="/css/bulma.css" rel="stylesheet" type="text/css" />

    {{-- <link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.4.2/css/bulma.css" rel="stylesheet" type="text/css" /> --}}

    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

    @yield('css_links')

</head>

<body>

    <div id="app">
       
        @include('partials/header')

        <div class="columns">

            <div class="column is-one-quarter">
           
                @yield('sidebar')

            </div>
            
            <div class="column is-three-quarters">

                @yield('content')

            </div>

        </div>

        @include('partials/footer')

    </div>


    <script href="/js/list.js" type="text/javascript"></script>
    <script href="/js/searchInit.js" type="text/javascript"></script>
</body>

</html>

When i load the page this is what the src looks like: http://i.imgur.com/08b9v48.png

What i don't understand is why is it ignoring the js folder/files. Even when i move a js file into the css folder, it still doesn't see it. I have no way of diagnosing this problem because i never had it before and i have not found my problem through the googlez.

14th June, 2017

Riotsmurf left a reply on Am I Doing This Right? • 2 months ago

Snapey: Hmm i see what you mean.

We had a database idea at first but then felt like we didn't want to store this information because its just requirements that are set by the state. We felt like the law does not change enough, and if it did it would not be a big deal to go into the FlowerMixTypeTest class and set the $requiredTests variable to what it would require. Then commit, push, and merge. Would you consider this bad still?

I suppose it would be about which is faster/easier for the system. Whether it is easier to store and update this information in the database, or less time to change 1 class.

Riotsmurf left a reply on Am I Doing This Right? • 2 months ago

jlrdw: This is a select, not a checkbox or radio button. there are 6 parent types. VegetationType, ExtractType, TopicalType etc. I am not going to force the users to select "Flower" or "Flower Mix" and then check a radio button to pick vegetation because it leaves too much room for user error. This does not answer my question.

13th June, 2017

Riotsmurf started a new conversation Am I Breaking The O. Rule In S.O.L.I.D. ? • 2 months ago

I am creating business logic in my Laravel project. I am creating an order and adding samples to the order. Each sample( depending on its type ) has a set of tests that it requires by law so i made this.

So i use getTestCollection() to return tests a product type needs.

<?php

namespace App\TestLogic;

class Product
{

    private $type;
    private $typeFactory;

    //Set base test as potency. Potency->id = 6
    public $tests = [
            "Foreign Matter" => 0,
            "Microbial" => 0,
            "Moisture" => 0,
            "Mycotoxin" => 0,
            "Pesticide Residue" => 0,
            "Potency" => 0,
            "Residual Solvent" => 0,
            "Terpenes" => 0,
            "Water Activity" => 0
    ];

    public function __construct(ProductTypeFactory $typeFactory)
    {
        $this->typeFactory = $typeFactory;
    }
    /**
     * Gets a collection of tests based on the type of this product
     * @return Array Array of tests required by type.
     */
    public function getTestCollection()
    {
        $classType = str_replace(' ', '',$this->type);
        $productType = $this->typeFactory->getProductTestType($classType);

        return $productType->getTestCollection($this);
    }

    public function setType($type)
    {
        $this->type = $type;
    }

    public function getType()
    {
        return $this->type;
    }
}

There are some types that require the same set of tests like, Flower and Flower Mix. So i made this.

<?php

namespace App\TestLogic;

class VegetationType implements IproductTypeTest
{
    protected $requiredTests = [
            "Moisture" => 1,
            "Water Activity" => 1,
            "Potency" => 1,
            "Foreign Matter" => 1,
            "Microbial" => 1
            // "Mycotoxins"
    ];

    public function getTestCollection(Product $product)
    {
        foreach ($this->requiredTests as $key => $rTest) {
                $product->tests[$key]+=$rTest;
        }
        return $product->tests;
    }
}

And my Flower, Flower Mix classes extend this. So now they are empty like this.

<?php

namespace App\TestLogic;

class FlowerMixTypeTest extends VegetationType
{
}

<?php

namespace App\TestLogic;

class FlowerTypeTest extends VegetationType
{
}

Should VegitationType be a trait and not a class? This is my first go at this and i have a feeling its a little weird...

Edit Your Profile
Update

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