shez1983

Experience

77,255

74 Best Reply Awards

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

24th September, 2018

shez1983 left a reply on Bugs On Has() • 45 minutes ago

@pramanadiputra uf the q doesnt provide useful info - how do you expect people to help you... ;)

22nd September, 2018

shez1983 left a reply on Bind A Url Param In The Service Provider? • 1 day ago

thanks.. didnt think to check the docs - i thought my case was unique but laravel 2 the rescue again

21st September, 2018

shez1983 left a reply on Session Or How To Do This • 3 days ago

laravel by default logs you in once you have registered... so i am not sure whats happenng with you.. (just tested this on my newly created laravel app)

shez1983 started a new conversation Bind A Url Param In The Service Provider? • 3 days ago

so i have couple of routes something like: {usertype}/something

now i dont want to do in the blade. route('name', 'userType' => ....) is there a way to bind userType to the real userType in service provider or somewhere else?

19th September, 2018

shez1983 left a reply on Stripe API And Widholding Funds • 4 days ago

i think this can be done - so when buyer buys something the money goes into YOUR stripe account - after the buyer has recieved and notified you/site you can then transfer money to seller..

you are protecting the buyer but who is protecting the seller? buyer can also fake and say i didnt recieve anything! (just a thought)

16th September, 2018

shez1983 left a reply on How To Speed Up Insert Query? • 1 week ago

few things i would do: assuming foreach ($items as $item) { is from your OLD db..

  1. use yield/generators (search internet for a basic example) they will reduce the memory down to practically nothing (well will use far less than foreach)

  2. i hope you are chunking the records and not doing a select * from old database...

  3. you could always use cursor syntax (ex of this and chunking are available in laravel)

  4. if you dont really need ELOQUENT then dont use it - use plain old 'SQL' which returns objects - you can use 2 & 3 points i mentioned with this without any problem

shez1983 left a reply on What Is The Problem On My Php Code!! • 1 week ago

we cant see the code.. thats your 1st problem ;)

shez1983 left a reply on Best Way To Log All DB Queries ? Events Or Logs? Seeking Advice • 1 week ago

spatie has a package that allows you to record any changes. all you need is to pull a trait to your models iirc

12th September, 2018

shez1983 left a reply on Is There A Right Approach To Calculate The Average Of A Rating System? • 1 week ago

the idea is that things you can calculate should not be stored in the DB ideally. if you have the right indexes the query can take < second. If you store calculated data then thats an extra headache for you to make sure it is correct all the time.

Now depending on the data/tables you could:

  1. update these columns rate_count, rate_average every 5/10 minutes (using a cron job/schedule command)

  2. or cache them via REDIS (so with this you are not creating a column to store avgs) again using a schedule command or on the fly and invalidate the cache when someone adds/update

shez1983 left a reply on REST API • 1 week ago

well ideally you would use ajax requests or use PHP guzzle Library (or similar) to consume the APIs.. its not that hard - depending on auth system used.. with Guzzle installed you would maybe create a wrapper class that hides the difficult parts. and maybe unifies the way you get data from the api

10th September, 2018

shez1983 left a reply on Admin Panel • 2 weeks ago

Thanks for Ur input as always.. @jlrdw as always..

The beauty of an admin panel is that it works with every site and you don't have to spend time creating crud forever again...

7th September, 2018

shez1983 left a reply on Admin Panel • 2 weeks ago

@cmdobueno no need to sound so condascending! i have heard of nova i just wanted some free/other alternatives..

@wilk_randall i dont want template - i want an admin crud generator

shez1983 left a reply on How To Turn Off Auto Login Users ? In Laravel 5.7 • 2 weeks ago

its called remmeber me feature.. you need to remove that from login section so people cant choose it. afaik

shez1983 started a new conversation Admin Panel • 2 weeks ago

I know this has literally been asked dozens of times.

I am after one that my company is hoping to use it in every project - we tried the https://packagist.org/packages/encore/laravel-admin but that was rubbish, i have tried crudbooster and it seems ok..

so crud with ability to extend it a bit..

any recommendations? I have googled and have 7 different ones but i would rather not install all of them and go through plus reading the docs to see if they can be extended or not etc..

shez1983 left a reply on Which Laravel Admin Panel Should I Use? • 2 weeks ago

@consil so which one did you go with? i have started a new job where they use z-song and its quite horrible, i dont really like it - too much faff about..

29th August, 2018

shez1983 left a reply on Reset Password • 3 weeks ago

for local you can use LOGS or maybe use mailgun (it has free tier) but you can also use server provided smtp/email sending is setup (you may have to use gmail/hotmail creds)

shez1983 left a reply on Different User Types - Handling Pages? • 3 weeks ago

wouldnt this make the view very unreadable? also the layout is different for each usertype so i definitely need different data from my models..

shez1983 started a new conversation Different User Types - Handling Pages? • 3 weeks ago

so on my system, i have different user types. so when i go to dashboard for each, i see a different page.. how should i handle that?

Url: should be domain.com/dashboard

Controller: should it be a [email protected] with if statement and then either getting data relevant and using views OR redirect them to [email protected] or [email protected] etc?

for other links some are same ie both client & admin can see users.. so again

URL: domain.com/users

Controller: similar to above?

21st August, 2018

shez1983 left a reply on Different User Types? How To 'code'? • 1 month ago

@martinbean so you are saying i have a policy that dictates what people can do? how do i extend it to say this user cannot see this page...

20th August, 2018

shez1983 started a new conversation Different User Types? How To 'code'? • 1 month ago

so if i have diff type of users (client, students, teacher) with some same fields some not - how should i approach this? how would login work? should i do user model and then just have a type? or do i actually have three entities and then do a one-one with user?

shez1983 left a reply on Duplicate Failed Due To A Cut Column Name • 1 month ago

you should copy the object rather than do it like that.. as objects are copied by reference so $newUser still refers to $oldUser (or something like that)

http://php.net/manual/en/language.oop5.cloning.php gives you a bit more info

15th August, 2018

shez1983 left a reply on FirstOrNew Adds Unwanted Attributes • 1 month ago

i agree just add slug to the database - saves some php/laravel execution time..

shez1983 left a reply on Fully Rely On API? • 1 month ago

there is two reasons for wanting to change it into API -

  1. for learning purposes (think microservices)
  2. if you want to ever extend and create apps/expose your internals via APIs

APIs might create overhead thats true, but when you add varnish, laravel cache etc it wont be that much

shez1983 left a reply on Laravel Api Return Null • 1 month ago

really? you just need to add what i said to that query i commented/posted on my last post.. before get().. if you dont know the basics, please take time to go through a beginner's course

shez1983 left a reply on Any Chance On Updating React Series? • 1 month ago

i think he has moved on to VueJS.. :p

shez1983 left a reply on Laravel Api Return Null • 1 month ago

you just need to update your query:

$images = Image::orderBy('order','ASC')->select('id','path','order','visible')->get();

to say whereNotNull('visible') and then you wont need that if statement..

shez1983 left a reply on Organising Controllers And Models For Creating Records That Can Be Related To Two Other Models • 1 month ago

no you will have a create function in each controller and pass in school id which you can use eloquent to get the model and then save the contacts details..

shez1983 left a reply on How Can I Convert Many Statement Mysql To Laravel Eloquent? • 1 month ago

if you can give some exmple output of that query or what you are trying to do then that would help. but i read you said you dont know (did you copy this sql from google search?)

shez1983 left a reply on Question About Chaining Eloquent Relations • 1 month ago

notice has many through will only work if your db tables are setup like the example, otherwise you will have to either:

  1. create a view in MySQL which uses two tables to create one VIEW which you treat as a table in laravel.

  2. create a custom function to do this in your USER Model

shez1983 left a reply on WithInput() Vs Compact() Vs View('view','data') • 1 month ago

it depends on you - i too personally like 1 as its less code to write (even with the help of IDEs.. lazy i know) but also easier to read and therefore understand.

go with one you like and just be consistent

14th August, 2018

shez1983 left a reply on Laravel Api Return Null • 1 month ago

can you post the whole functuon/code.. your code doesnt show where data: attr is being set..

shez1983 left a reply on Organising Controllers And Models For Creating Records That Can Be Related To Two Other Models • 1 month ago

Or a SchoolContactsController and StudentContactsController? is what i would opt for..in which case yur functions in those file will be simply index() create().. etc instead of

something complicated if you decide to go for ContactsController..

shez1983 left a reply on Forge On Ubuntu 16.04 • 1 month ago

it should - u can always try

shez1983 left a reply on Percentage Complete • 1 month ago

so you probably need one relationship to get alll chapters of a book, and another one which are completed, this uses the pivot table snapey mentioned so you only get chapters of the book that are completed by the auth user.. something like:

return $this->belongsToMany(User::class, 'pivot_table')->whereUserId(\Auth::id())

shez1983 left a reply on How To Change School_id To A Int For Save In Database? • 1 month ago

@irankhosravi you are making people angry @Cronix has been kind enough to leave comments on how to implement what you need and asked you repeatedly if you have followed the comment and you keep ignoring instead you give him more code so he can read and give you the correct version

if you want someone to help you with your project go to a freelancer site and HIRE someone.. or LEARN THE BASICS of vue/laravel/php/programming...

shez1983 left a reply on Percentage Complete • 1 month ago

i would go with what cronix has said.. dont worry about pages.. etc

also i think the complete()/uncomplete() should not go in the book model.. maybe repository/service.. it seems messy as its dependent on AUTH user..

just create another function called percentage, and do what cronix has said

shez1983 left a reply on How To Use Package From Vendor Directory • 1 month ago

i think you need to use the components yourself :s https://adminlte.io/docs/2.4/main-header...

shez1983 left a reply on Explain On How Asset() Helper Work • 1 month ago

you can drill down to the 2nd asset function..

12th August, 2018

shez1983 left a reply on Laravel 5.4 Get Insert Id From Eloquent Model • 1 month ago

Cronix already did.. from your code $activity->id is the id from table.. if it isnt working then it could be the model is not being saved in which case go to this url using POSTMAN (or inspect element from your browser to see what is happening) or logs..

shez1983 left a reply on Cannot Display Image File To Index Page, Using The Edit/update Method • 1 month ago

what does every other input shows, except the image file mean? what happens when you do a dd($request->all());

if the file isnt showing then there could be a problem with image/ uploading file etc

shez1983 left a reply on Is Laracast Becoming Unreliable • 1 month ago

maybe because they cant - no one is committed to do anything they dont want to, people help because thye want to not because they HAVE TO.. you just need to be patient.. theres always slack channel or StackOverflow you can try

shez1983 left a reply on Cashier: NewSubscription Doesn't Create Stripe User • 1 month ago

i think when the JS code sends users details to stripe THAT creates a new token. this code just creates a new subscription for that user.

You can always dig down and see exactly what newSubscription() does.

shez1983 left a reply on How To Disable E_DEPRECATED • 1 month ago

its not laravel, its PHP afaik..

also try adding error_reporting = off.

but googling around your error_reporting thing should have worked (is that in php.ini or anywhere else?)

shez1983 left a reply on Load Test Failing For 500 Concurrent Users? • 1 month ago

@timersys did you find a solution? sorry didnt see this thread until now...

@cps unfortunately no.. what we did was we added more servers/upped them to max etc when we needed to.. laravel really is slow :(

you can try microservices, caching (varnish) so it can serve the user without even hitting laravel, php7's opcache...

shez1983 left a reply on Request Is Taking Forever After Upgrade To Laravel V 5.6 • 1 month ago

is your appliction actually www.example.com:? and what do laravel storage/logs say?

shez1983 left a reply on Cashier: NewSubscription Doesn't Create Stripe User • 1 month ago

this should be:

$user->newSubscription('main', 'my_plan_name')->create($request->token);

shez1983 left a reply on Redirect Certain User • 1 month ago

just below the call to ::all();

can you do dd($users[0]->email) and see what gets printed to the page.. there MUST be something wrong there..

and also just for testing purposes add return '/posts'; right after the function start to see what happens.

shez1983 left a reply on Detect When A Model Is Queried For Resulst • 1 month ago

two things

  1. long winded but use getNameAttribute for each field & add appendsToJson() for more info: https://laravel.com/docs/5.6/eloquent-serialization#appending-values-to-json

  2. or try attributesToJson() if that exists..

shez1983 left a reply on Laravel App Usages More Than 90% CPU Usages For Only 100 Concurrent Users With High Server Configuration • 1 month ago

laravel does use a lot and is also the slowest one - i think you need varnish outside of laravel not some package.

Edit Your Profile
Update

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