Jump to content


  • Content count

  • Joined

  • Last visited


This user doesn't have any awards

1 Follower

About leodaniel

  • Title


  • CPU
    i7 4930k @ 3.4GHz
  • Motherboard
    ASUS Rampage IV Gene
  • RAM
    4x 8 Gb Kingston HyperX 1866Mhz
  • GPU
    NVIDIA GTX 780 (Reference Design)
  • Case
    FractalDesign R4 Mini
  • Storage
    2x 120Gb Samsung Evo - 2x 4TB Caviar Black - 2x 2TB BackupDrive
  • PSU
    Corsair AX760i
  • Display(s)
    2x DELL U2713HM
  • Cooling
  • Keyboard
    Apple Wireless KeyBoard
  • Mouse
    Logitech MX Master
  • Sound
    Focusrite Scarlett 2i2
  • Operating System
    CentOS 7 & Windows Professional 10

Contact Methods

  • Twitter

Profile Information

  • Gender
  • Location
  • Biography
    Business Management Student @ University St. Gallen (Switzerland), WebDeveloper / Designer (PHP / Javascript / HTML5 / CSS3)
  • Occupation
    Business Management Student @ University St. Gallen

Recent Profile Visitors

579 profile views
  1. vertically center when coding a website

    As we are in 2018 you can use Flexbox Vertically centering is made easy: .parent{ display:flex; align-items:center; }
  2. Laravel L55 return custom $errors to the view

    You can throw a validation exception...
  3. I personally use MJML and webpack for that. I think its one of the best options and easy to configure with Laravel mix
  4. Laravel form submits to multiple tables.

    In my opinion, JS is the future (and I have to admit i really like it) but I understand you
  5. Laravel form submits to multiple tables.

    So thats right, nothing about that, arrays always have keys Maybe, if it gets more complicated, use a ajax to send your requests (axios? maybe in combination with vue)
  6. Laravel form submits to multiple tables.

    Oh you are probably talking about a model right? Yes use create
  7. Laravel form submits to multiple tables.

    I changed it a little bit, because of course the Request extends SymfonyRequest and will probably throw an error / notice if you construct it just like that. I think, i would use either store or create... I think store is more common
  8. Laravel form submits to multiple tables.

    If it makes your validator way to complicated, consider just merging the rules. It just looks way cleaner than having complex rules. <?php class CustomerRequest(){ /** * @return array */ public static function getRules(){ return [ 'customer'=>'required' ] } /** * @return array */ public function rules(){ return self::getRules(); } } class CustomerTaskRequest{ /** * @return array */ public function rules(){ return array_merge( [ 'task.name'=>'required', ], CustomerRequest::getRules() ); } }
  9. Laravel form submits to multiple tables.

    No, I would do different requests for that. Of course you could, take a look at the validation documentation, there you have the possibility of conditional validation. I think if one is only about the registration you will need other logic, but depending on how you build it, you can reuse it it's a bit hard to judge, personally I would go with 2. Transaction simplified (MySQL): Use them when you have a block or unit of work which needs to either success completely or fail. I only mentioned it, because it seemed like quiet some queries to execute Basically, all succeed or none
  10. Laravel form submits to multiple tables.

    Also if you require more complex validation rules I would just simply create those custom validation rules artisan make:rule MyCustomRule The you can simply add them to the validator <?php return [ 'customer.first_name'=>['required', new MyCustomRule] ]
  11. Laravel form submits to multiple tables.

    I help where I can So first of all I would use requests for that: <?php class CustomerRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'customer.first_name'=>'required|max:55', /* Add all rules */ ]; } } Now you can easily just add following line in your controller <?php class CustomerController extends Controller{ /** * The request is already validated! */ public function create(CustomerRequest $request){ /* Create your models here. */ DB::transaction(function () { /* Save All that stuff */ }); } } I hope that helped I don't know if I understood your question correctly otherwise
  12. PHP help with $values

    Always whats more human (you and me ) readable. Name your variables appropriately (having var1-var15 is bad, its hard to understand what they each represent), always step by step so that it's easy to understand. Just try to make it simple. Imagine you would have to look at your script again in 10 years... how long would you take to understand it (goal is to shorten this time). I think it's important to always code with that in mind. In the 2. code example it's really hard to understand what the code does, what the variables are. It takes quit some time to understand what it does.
  13. PHP help with $values

    So yes this is possible: <?php $v1 = 10; $v2 = 5; echo $result = ($v1 / $v2); // output: 2 var_dump($result); // output: int(2) The question is more, should you write this? I would argue for no. I think it's more readable to first only create the value $result and then echo it separately. I think it's more readable and in the end this should be your goal. The computer will always understand messy code, but humans tend to have more problem with that. Think of it like this, you should alway write code for humans first, not for computers. If you stumble across your code in a year, which would you find easier to understand (or anyone else)? I would go with that. Even if it's one line longer <?php $var1 = 10; $var2 = 5; $result = ( $var1 / $var2 ); echo $result;
  14. EV and more environmentally health future?

    The efficiency of such a car (hydrogen) is just way below an electric car. Then the second problem: You have tu build an infrastructure for Hydrogen stations (including storage, delivery and production) compared to an already existing electric grid, really expensive. Then you need to produce the hydrogen in the first place, which is either resource intensive (hydrolysis) or comes from natural gaz. So in total, really expensive but not impossible. Tho bringing the price of Fuel cells down and building a solid infrastructure is a big challenge.
  15. EV and more environmentally health future?

    Clearly EVs are the way to go. They provide a chance to be greener in the future. As stated by many, today an EV is not better (ecologically) at time buying. BUT it gets better compared to an Gasoline one with EVERY km driven. Depending on your electricity mix, the required kms vary a lot. In average an EV will produce around 90 Gramm CO2 per KM over its whole lifespan (with the average EU electricity mix). This is a saving of 55% compared to the average diesel car. I think there is a lot of misconception about the true impact, or stress EVs will cause on the electric grid. It's not that from one day to the other, all cars will be electric. It's more like a slow revolution (it's like when gasoline cars first came up, there wasn't an infrastructure of gaz stations already available). And of course the grid is more than capable of handling a lot more EVs in it's current state. Also it's worth mentioning that a lot of EVs are charged when demand is low because of the cheap energy. But of course it needs improvements in the future tho (--> smart grid). Also, EVs won't resolve climate warming, but they at least play a role in doing so. But it should not be forgotten, that moving a car will always cost energy, no matter what. So yes, EVs play a role, but we need (as a society) to take steps, which will hurt us to reduce climate change (ex. eating less meat, consuming less energy, less flying, ...). Source about EVs: https://www.transportenvironment.org/publications/electric-vehicle-life-cycle-analysis-and-raw-material-availability