shez1983

Experience

73,615

70 Best Reply Awards

  • Member Since 2 Years Ago
  • 205 Lessons Completed
  • 1 Favorite

21st July, 2018

shez1983 left a reply on Set Laravel Cookie To Have A Random String As Value Until Deleted • 13 hours ago

what do you mean by change? of course if you are hitting that controller it will change its value because str_random(10); will make it change... if you only want to change it if it doesnt exist wrap the code in an if statement to test whether the cookie exist or not..

shez1983 left a reply on How To Add Headers In Laravel Request • 13 hours ago

not sure at what point you want to add headers? normally if you are using ajax then you would use the JS to add the headers and in laravel you could use a middleware to check if those exist.

shez1983 left a reply on Laravel RAW Query With IGNORE Doesn't Work As Expected • 14 hours ago

are you changing FLIGHT column or DEPARTURE column.. as it stands it looks like your table is called departure and column flight which doesnt make sense to me.

20th July, 2018

shez1983 left a reply on Storing Likes And Dislikes For Comments & Replies • 1 day ago

declare? in the add the cookie comment above...

shez1983 left a reply on Docker Series • 1 day ago

regarding kubernetes - theres a course on EDX..

shez1983 left a reply on Lumen POST Routes Not Working • 1 day ago

how about if you commented out the /GET route code to see what it does then? seems weird..

shez1983 left a reply on Inaccurate Mentions On Forum • 1 day ago

but you can go to that thread and see if the guy who mentioned you has an edited post.. or maybe just ask him directly

shez1983 left a reply on Storing Likes And Dislikes For Comments & Replies • 1 day ago

something like this

// controller func 

function like() {
    // check if cookie exists (assuming for that post/whatever)

    // if it doesnt increment like 

    // add the cookie.  


}

18th July, 2018

shez1983 left a reply on URL - Remove Square Bracket From Url While Using GET Method • 3 days ago

i think doing that might give you a headache, normally in php you can easily get all category by doing $_POST['category'] afaik.. with your way you will have to do extra work (well explode) but also JS implementation as mentioned above.. if there is no reason i would leave it

16th July, 2018

shez1983 left a reply on Query Log • 5 days ago

you can also enable slow query log on your server so it will log all slow queries.

12th July, 2018

shez1983 left a reply on Help With Visit Counter • 1 week ago

have you integrated that package to work with POSTS? reading the doc it only works with pages/over all stats not posts..

for posts you can basically add a new field in posts (called views) (or if you have other things you also want to add counter to, look into morph type relationship) then when user goes to that post in your url you increment the view.. (you could also store the IP address in a separate table so you dont increment the view again for same IP)

then query on that

shez1983 left a reply on Array To String Conversion Error (shows Up On Production Server) • 1 week ago

can you also give an example query result you get? the only thing i can think of is for some ->where('leads.id','=',$id) leads Id you are NOT getting the data you expect hence the error.

Thats the only thing that has caught me of guard before.. btw why are you not using eloquent & relationships?

shez1983 left a reply on Dusk Test Not Working As Expected • 1 week ago

like i said if you show the code of your tests then maybe we can find the real problem instead of trying to come up with a band-aid..

shez1983 left a reply on Simple Refactor Doesn't Work • 1 week ago

btw in this case you shouldnt be re-using the controller function.. instead create a new class (Question repository, Question service etc) where you put this logic, and then you call it from both setCounter and nextt controllers..

shez1983 left a reply on Csrf Problem • 1 week ago

if its a laravel project then it should all work fine.. unless your cloned form is sending request to the other project? in which case you are using APIs and apis dont use CSRF..

shez1983 left a reply on Csrf Problem • 1 week ago

so you add the csrf field in your cloned form in the 2nd project.. {{ csrf_field() }} inside your form

shez1983 left a reply on Dusk Test Not Working As Expected • 1 week ago

code please?

shez1983 left a reply on Laravel Mailer In Not Working With Me . • 1 week ago

is there an SMTP setup on you server? can you try getting a test account on mailgun and using that to see if this is the error?

shez1983 left a reply on What Thing Require To Migrate From Http To Https • 1 week ago

nothing else should be needed. laravel should already take care of making sure all links are now https.

shez1983 left a reply on Running Command Through Scheduler • 1 week ago

what is the command doing? surely there should be more log info in the logs than just that line? if not, i would add more logs to see where it is not doing what it should be. Perhaps give us the command code?

shez1983 left a reply on Relations • 1 week ago

you could further complicate (normalise it) by

    $table->increments('id');
    $table->unsignedInteger('device_id');
    $table->string('name');
    $table->string('value');
    $table->timestamps();```

could be

Schema::create('attributes', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('device_id'); $table->string('attribute_id'); $table->string('value_id'); $table->timestamps();


attribute_id = > table with id, name  e.g  1, Colour, 2 Storage, 
value_id => table with all options id, attribute_id, name:  1, 1, Blue,  2, 1, Red,  3, 2, Storage_value

24th June, 2018

shez1983 left a reply on Creating Model Factory Methods • 3 weeks ago

i think my last paragraph With regards to your function name i am not sure what you are actually doing ie createForWrestlerOnDate or createMatchForWrestlerOnDate.. you can use either as long as the one that makes more sense for you is applicable - i dont know which one makese sense as its your project.. choose whichever one makes sense for you!

shez1983 left a reply on Creating Model Factory Methods • 3 weeks ago

if match needs to have an event then in the match factory where you have event_id you can have an anonymous function which creates a new event..

if this isnt suitable because you need to specify a DATE as i can see in your example code then create a new function (either on TestCase or a helper file which you autoload using composer only for dev env),

With regards to your function name i am not sure what you are actually doing ie createForWrestlerOnDate or createMatchForWrestlerOnDate.. you can use either as long as the one that makes more sense for you

shez1983 left a reply on Count Comments Associated With A Post • 3 weeks ago

can you try $comments = Post::with('comments')->get(); and see if that works?

i am not sure why your code doesnt work.. just checked docs and should work it seems :s

shez1983 left a reply on Multiple Pivot Table Or One Pivot Table With Multiple Columns? • 3 weeks ago

naming depends on what relationship it is you are trying to link two tables.. ie subscribers as opposed to product_users.. so anyone can see whats happening.. because in certain cases you might have product_users again for another relationship

shez1983 left a reply on Remove Global Scope In Boot Method • 3 weeks ago

if a scope isnt applied in EVERY CASE then really it shouldnt be a global scope.. you could relegate it to a local scope which you call when needed.

21st June, 2018

shez1983 left a reply on Can't Connect To Mysql • 1 month ago

if you reformatted your mac,did you reinstall mysql? and are you running mysqld?

shez1983 left a reply on What Is The Suitable Number Of Queue Workers ? • 1 month ago

of course.. each worker consumes certain amount of resource so if you have LOTS then the server could crash..

generally it depends on the severity of your work.. for example for transactions happening in real time, you need MORE queue workers than say sending a welcome/forgotten password emails..

it also then depends on how big ur VPS is.. this i dont know but one tip is that if you use forge and try to create new/more workers and check their status, eventually you will get/see errors.. this indicates that you have reached the limit.

Also try to create a separate VPS for your queue

shez1983 left a reply on How Can I Get Lat Long Coordinates From Address? • 1 month ago

whats not working? you have the code and apparently you are using geocoder to get lat/long?

shez1983 left a reply on Multiple Pivot Table Or One Pivot Table With Multiple Columns? • 1 month ago

definitely separate.. you could consider a polymorphic type where you have an extra field but KISS.. just have a separate tables one for watchlist, one for transactions.

shez1983 left a reply on Uploading Large Files With Progress • 1 month ago

not really.. you could fake a progress bar.. so when user uploads a file, get the file size/do some calculations to see how long it usually takes and then add some more..

to do it for real, you need to track progress which I dont think AWS gives you

shez1983 left a reply on Laravel 5.6 Session Persistence Issue • 1 month ago

are you saying TWO diff users get/see each others account?

shez1983 left a reply on Problems With Special Characters • 1 month ago

is the file itself utf8_encoded? when u open the file do you get correct characters or..?

shez1983 left a reply on Remove Global Scope In Boot Method • 1 month ago

perhaps you can remove this through a controller/services/repository

where you have a function lets say

{

if ( $removeGlobalScopes) {
    Product::withoutGlobalScopes()->all();
} 
else
{
///
}
}

shez1983 left a reply on Run A Job Every X Minutes And Maximum N Times Before Fail It (not With Artisan) • 1 month ago

well a cron job can run every x minutes.. to make sure it only runs n times you need to store this somewhere (perhaps a simple txt file which contains a counter.. once you reach a certain count just do an if & return early..

btw hasToken in your code, what is this?

shez1983 left a reply on Hypens In DB Data Returning Substrings • 1 month ago

it is documented.. laravel docs are cool :)

20th June, 2018

shez1983 left a reply on Accessing Public Storage With App On Subdomain • 1 month ago

one thing you can do is go to your storage folder and run pwd in it.. and then dump() in your script two should match

shez1983 left a reply on Hypens In DB Data Returning Substrings • 1 month ago

wait if primary key is sku, do u have it set as autoincremneting = false (or something similar) otherwise laravel by default might treat it as int..

19th June, 2018

shez1983 left a reply on Separate Front And Backend Completely? • 1 month ago

i disagree a bit with the previous poster..

it depends on what you want (future as well) if you want to build an app in the future then api is the way to go- but if you want to separate the backend from frontend then API is still the way to go.

I think APIs make sense, create a separation of concerns, you can also then use ajax calls..

15th June, 2018

shez1983 left a reply on How Can Modify The Request Input Before Validation • 1 month ago

you can copy TrimStrings middleware & adapt to your own needs...?

shez1983 left a reply on Where In Multiple Columns • 1 month ago

@Shahrukh4 dont forget the sql injection others pointed out

14th June, 2018

shez1983 left a reply on Hiding Id's • 1 month ago

you can also hash Ids theres a ramsey/hashId package.. or something..

3rd June, 2018

shez1983 left a reply on Which Directories / Files Can I Remove Safely From The Laravel Package? • 1 month ago

but these files are really small in size - it looks like you have a shared hosting and are doing uploads..

you shouldnt be deleting any files/folders.. why do you feel you need to do that? if you remove composer, how are you going to update your packages? add more when you need them? if you remove artisan, how will you run commands/queues/workers..

1st June, 2018

shez1983 left a reply on Doubt About Create The Database Schema With Laravel • 1 month ago

technically you dont need to create fk as long as your tables are correct (ie in the above post with category_id for example).. but fk make the querying faster

29th May, 2018

shez1983 left a reply on Double Isset? • 1 month ago

i think this should be:

<td>{{ $value->audits->subdomains->name ?? $value->incsubdomains->name ?? '-' }}</td>

you cant have a it like you have... ternary wants ONE : not two..

another way would be to create a helper function (for blade, or model that does the complex logic) and use that.

26th May, 2018

shez1983 left a reply on Repository Pattern And Relationships • 1 month ago

take a look at this post which deals with relationships

https://medium.com/@smayzes/how-do-you-work-in-laravel-5a763fe5c5a0

21st May, 2018

shez1983 left a reply on Enterprise Applications • 2 months ago

if you want to have a site that responds to that many (or at least 10000s) of users per second, i would not go with php/laravel - from experience its very slow..

11th May, 2018

shez1983 left a reply on Decrypt Form • 2 months ago

have u manually checked what $_REQUEST['mypost'] shows? also give us the view code.. maybe you are doing something wrong

10th May, 2018

shez1983 left a reply on Use "nick" Instead Of "name" In Users Table • 2 months ago

if you all looked in the RegisterUser trait you would realise there is nothing special happening - it uses Request validator from the files in http/COntrollers/Auth etc so you need to post your errors?

the only thing is that you need to change your auth.register view to change field name (auth views are all there in views folder)

9th May, 2018

shez1983 left a reply on Use "nick" Instead Of "name" In Users Table • 2 months ago

you know you are allowed to CHANGE Them - they are not part of the package..

Edit Your Profile
Update

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