shez1983

Experience

80,745

77 Best Reply Awards

  • Member Since 3 Years Ago
  • 211 Lessons Completed
  • 1 Favorite

22nd October, 2018

shez1983 left a reply on Nested Query Function • 10 hours ago

seriously you need to do your own research, but before that read the docs/understand whats going on - at this rate it will be a month before you get your answer..

name instead of tasktags.name will get you on the right track.. iirc

shez1983 left a reply on Why I Can't Send Emails Within A Controller In Laravel 5.7? • 10 hours ago

2 things to try:

  1. check laravel logs and see if there is an error
  2. add a try/catch to see if there is an error

from my pov - it should be working, of course you SHOULD remove the to() call from the build method as its redundant.

and you do not post your code for your controller so how are we supposed to figure out why its not working?

20th October, 2018

shez1983 left a reply on Nested Query Function • 2 days ago

i suspect its $q->has('tasktags', '=' , 2)->whereIn('name', $TagArray)->with('tasktags'); that is the problem, u r already in tasktag model here which i dont believe has another relationship called tasktags... u dont need that there again...

shez1983 left a reply on Multiple Foreign Key Reference To Same Primary Key • 2 days ago

snapey is right.. you say yourself its nullable - if nullable then you need to guard against that or it will throw an error.

that aside few things:

  1. your column names are not consistent (camelCase & snake_cases)
  2. in your foreach do this {{ {{$task->assignedTo()->toSql() }} to see what query is being produced and then try that in SQL (figure if thats the right query etc) - something must be off..
  3. other thing is if tasks can be assigned to multiple users then you have a problem

shez1983 left a reply on API Request Keeps Loading - Laravel 5.7.1 • 2 days ago

i think i create a fresh installation of laravel and then test it without doing anything go to the home page, hit fresh on your browser couple of times... and see if you get the same thing..

without knowing what you have done with your laravel installation we cant help you - github repo would be better..

19th October, 2018

shez1983 left a reply on How Much Is A Mid-level Laravel Coder Worth Per Year? • 3 days ago

php coders get paid way less than other languages.. (and thats a GENERAL rule i have seen, stack overflow do an annual survey etc and they have proven this to be the case) but where i am i have seen laravel positions with at least 60k... and thats a good amount to live on

shez1983 left a reply on API Request Keeps Loading - Laravel 5.7.1 • 3 days ago

how about if you do it in a browser? and refresh..

17th October, 2018

shez1983 left a reply on Is There A Way To Validate Blade Syntax • 5 days ago

i wonder how laravel knows when you change the blade so that it should create a new cache..

shez1983 left a reply on Laravel Forge - Complete List Of Past Deployment Logs • 5 days ago

yes you can.. but you have to SSH in to your server and go to a hidden .forge directory. by default forge keeps the last x deployment logs, not only that it will also keep cron jobs/consoloe logs there as well..

i am not 100% sure where this directory is, from memory it might be in your home so do cd ~/home and then ls -al to view all directories... (if not there it should be on your SITEs folder but the first one sounds like a more distinct possibility)

shez1983 left a reply on Change Database Dynamically • 5 days ago

you are confusing exceptions with general rule.. just because in some cases its a requirement doesnt negat the fact its bad and you are having to do this as a requirement...

16th October, 2018

shez1983 left a reply on Change Database Dynamically • 6 days ago

even with multi-tenancy you can actually just have ONE database... @wilk_randall maybe it isnt a bad thing :s

shez1983 left a reply on A Question About "Authorizing Form Requests" • 6 days ago

you either do \Auth::user() or $request->user() provided the controller func has Request in its func params..

shez1983 left a reply on Change Database Dynamically • 6 days ago

ideally this is a BAD idea.. you should just have one DATABASE..

but you could create a middleware and in it all you need to do is change the env('DB_NAME') = client1....

15th October, 2018

shez1983 left a reply on $with Inside Two Models Causing A Strange Loop • 1 week ago

i'll be interested to know the workaround but at this moment the loop makes sense although unwanted..

you could remove with() from employees and always just do $user->employee (or vice versa)

shez1983 left a reply on Barryvdh/laravel-debugbar Does Not Appear In Laravel5.6 • 1 week ago

there is another env setting that it also looks for (debug=true or not) or something similar (although that is tied to env... as well)

14th October, 2018

shez1983 left a reply on It Is Posible A Query For My Data? • 1 week ago

yes..

shez1983 left a reply on Sorting Conditional API Resource Relationships • 1 week ago

you can sort by in the actual relationship which i assume is defined in this models relationship() function so something like

return $this->hasMany('')->orderBy(sort col);

shez1983 left a reply on Back-end Lumen And Front-End Laravel • 1 week ago

UNLESS you might build an APP in the future..

shez1983 left a reply on Parent-child Relations (Resource Handling???) • 1 week ago

how can a flavour contain other flavour - doesnt make sense. you need to expand a bit..

shez1983 left a reply on Call To Undefined Method • 1 week ago

by default LARAVEL takes care of it for you.. are you doing a custom thing yourself?

shez1983 left a reply on Problem With Redirect From Controller • 1 week ago

you could either:

  1. have a repository (service makes more sense) - where you put your logic (a function) that blocks the user & then unfollows him (unfollows him should be a call to another function... and then you use this unfollow function in your afterBlock() function to keep code a bit dry)

  2. you use events.. so create an event (userWasBlocked, and then have differnet things happen) - this way if you need to do an additional thing, you dont haev to modify the code you just add it to the event listener..

as a further help: the way you are naming your controllers & functions is not desireable.. and if you ever find you need to call another controllers function - it means that code needs to move into a repository/service and be called from those two functions.

shez1983 left a reply on Encrypting Json Data From Laravel Api • 1 week ago

if you encrypt it, your frontend will need to decrypt it to show it to the user. and your frontend will need to know HOW to decrypt it.. and as its frontend anyone can see the algorithm you use to decrypt so its pretty pointless

13th October, 2018

shez1983 left a reply on Related Products Relationship Issue • 1 week ago

i think you can do an EVENT created/deleted to do this.. otherwise you wont be able to create a nice relationship (you will have to create your own custom relationship but whih is just a Function to return related products)

shez1983 left a reply on Edit Using Modal Window • 1 week ago

so wait on one page you are creating x amount of forms so that when a user (admin i think) clicks on edit you open the form related to that user?

that seems a bit crazy.. you ideally should get that data on ajax so you dont load x amount of data when an admin may not even do edit.

12th October, 2018

shez1983 left a reply on Relationships Always Null • 1 week ago

you can also do $token->refresh()->toSql() to directly echo out the q it is making (or if you have debug bar, if not you should) use that

shez1983 left a reply on Quick Deploy Not Working • 1 week ago

i dont know what u mean... i have given you the instructions.. :s

10th October, 2018

shez1983 left a reply on Dd(): Call To Undefined Function • 1 week ago

oh i just saw that you are using LUMEN and not laravel.. maybe DD isnt available in lumen.. which seems a shame..

but you can write your own: https://github.com/larapack/dd/blob/master/src/helper.php

shez1983 left a reply on Quick Deploy Not Working • 1 week ago

i think what you might need to do in the meantime is go to your repo setting so something like:

https://github.com/username/reponame/settings/hooks

and add a webhook to the URL which is listed in your FORGE Deployment Trigger URL.. so everytime you do a PUSH to the branch (Develop) this would/should trigger forge deploy

shez1983 left a reply on Override Any Attribute • 1 week ago

i have given you a solution 2nd para of my prev post.

if this prefix is hardcoded then just name your table column with that prefix.. if you want to do manipulation why would u do the same thing to every field doesnt make sense...

shez1983 left a reply on Dd(): Call To Undefined Function • 1 week ago

has it ever worked or did it stop working after you did something? try doing composer update/install.. try also searching for dd() using ur IDE and see if it comes up.. (ie where its defined)

shez1983 left a reply on How To Send An Email Verification For A Created User? • 1 week ago

by writing the appropriate code? Mail::()...

9th October, 2018

shez1983 left a reply on Array Transformation • 1 week ago

collections has a nifty zip() function that takes 2 collections/array and sort of does what you want.. but i dont think that WILL do exactly what you want..

i dont know of any functions i am afraid..

shez1983 left a reply on Blade CustomHelpers With Loop $key? • 1 week ago

i quite clearly said when i do a dump inside the blade directive, on the screen i see the '$date' literal - i cant be any more clearer than that..

shez1983 left a reply on Quick Deploy Not Working • 1 week ago

what happens when you click on quick deploy? anything? and do you have the scripts to run? you need to add those in the text box on the same page..

shez1983 left a reply on Env File In Forge • 1 week ago

it should be hidden by default, you dont need to do anything

shez1983 left a reply on Override Any Attribute • 1 week ago

why do you want to override these attributes? need to give more example/your scenario

you could create your own helper function getOverriddenAttribute($attribute) and then do whatever it is you need in there..

shez1983 left a reply on Dd(): Call To Undefined Function • 1 week ago

does dd work else where? like your templates, other controllers? does dump() work?

what version of laravel are you?

shez1983 left a reply on Can't Disable Maintenance Mode • 1 week ago

do you get any errors when you do php artisan up?

all php artisan down does is create a file in storage/, you can also manually remove that file and you should be good to go..

shez1983 left a reply on Front-end Of CrudBooster Is Not Working • 1 week ago

retry the crud booster install process again - also make sure you do npm run/or whatever the command is these days to compile the assets..

I have successfully installed crudbooster..

shez1983 left a reply on Lumen With React Or Frontend Separate • 1 week ago

well lumen is supposed to be for APIs not for views/a website.. so ideally you should consume your api/lumen from JS using axios/ajax whatever..

but if it is a simple site and if lumen allows blade/views then i dont see any harm :)

shez1983 left a reply on Laravel Cashier Webhook Response From Stripe • 1 week ago

is this your local or staging? on local it wont work - you need a fake URL (search for it that capture the response http bin from memory)

if this is in staging then what i would do is when you do the test from stripe (ie where it says test this hook/end point) then you can copy the Request it sends and use postman to see what your server is doing.. (if you dont get the request this way, use the above way to get a sample request).

also how about dumping the payload before the try { } and see what you get?

shez1983 left a reply on Blade CustomHelpers With Loop $key? • 1 week ago

thats the thing serialize = json object.. anyway will try this.. thanks

shez1983 left a reply on Blade CustomHelpers With Loop $key? • 1 week ago

i have mentioned this but i will repeat..

when i echo $date inside the blade directive, it echoes out '$date' and not the value of the variable ie a string..

but you are right i did parse the date...

Reason for using a helper is becuase we are extracting date/time all over the place so it would be handy to have it defined in one place should we need to change the format.

@D9705996 casts sounds like a good solution, even i knew about it but i thought it might mess with saving/creating/updating.. or is this purely used when we echo the field/property?

shez1983 left a reply on Auth::user() Returns Null In Middleware • 1 week ago

I am doing soemthing similar in my middleware and it is DEFINITELY working..

the only issue i have found is that accessing Auth::/Request in a controllers __construct() doesnt work (but there is a workaround, search on the net)

shez1983 left a reply on Writing Route Tests With Proper Feedback • 1 week ago

you could change your assertion slightly

assertEquals($expected, $actual, $message])

and have the URL that failed in the $message...

shez1983 left a reply on Blade CustomHelpers With Loop $key? • 1 week ago

when i echo date in the blade itself i get the correct timestamp whatever it should be.. its just not being passed to the custom Helper...

shez1983 left a reply on How To Create Md5 Password In Php And Save To Database? • 1 week ago

@D9705996 how is php md5() any securer than MySQL if they are both MD5?

OP: if you are using laravel then it has bcrypt() function pass it a string and it can create a secure hashed password...

shez1983 left a reply on Too Few Arguments To Function • 1 week ago

no one is going to read this code line by line to make sure ALL your function calls have appropriate parameters being passed in..

usually php/laravel tells you where the error is - in which case you should be able to realise which func is causing the problem

shez1983 left a reply on Trigger Parent Timestamp Touch On Mass Update • 1 week ago

you could also perhaps use a MYSQL trigger... that does this for you..

shez1983 started a new conversation Blade CustomHelpers With Loop $key? • 1 week ago

so i have a blade helper:

            return "<?php echo ($expression)->format('D d, M'); ?>";
        });```

and normally when i echo out a model's date like so: ```@date($model->start_time)```

works nicely.. 

but i am doing a foreach (on invoices grouped by date paid) so i get a collection which has a date (or null) with another collection as 'values'.. so i am doing:

@forelse($invoiceGroup as $date => $invoices) @date($date) @foreach($invoices as $invoice)


```@date($date) ``` is giving me problems and not working.. it doesnt pass in the actual value of $date to the @date() function and so i get an error cannot format a string '$date'..

i have dumped($expression) and indeed it is = to literal 'date' and not whatever the date is..


(for now i have created a php helper which does the same thing but kind of annoying..)
Edit Your Profile
Update

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