shez1983

Experience

68,015

65 Best Reply Awards

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

26th May, 2018

shez1983 left a reply on Repository Pattern And Relationships • 13 hours 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 • 5 days 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 weeks 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 weeks 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 weeks ago

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

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

why is nickname causing problems? i dont understand.. in my app i have never had name column - first_name, last_name.. most of the time and auth works..

6th May, 2018

shez1983 left a reply on Web Development Became Too Complex • 2 weeks ago

I am in the same boat - I have few years experience and pay is higher - but i still wonder if i have all the skills because I know I dont.. for example JS frameworks, modern css.. for now I am backend dev but even then my expertise are quite limited..

but i guess as long as I have a job doing what I do - thats all that matters..

shez1983 left a reply on Database Tables Values Assign As A Table Header In The DataTables • 2 weeks ago

i think he meant if the headers change or stay the same...

shez1983 left a reply on Can't Decide How To Organize My App As It Grows More Complex • 2 weeks ago

so you extract them into repositories/services and then use those functions in your controller methods

5th May, 2018

30th April, 2018

shez1983 left a reply on Instagram • 3 weeks ago

facebook docs are notoriously PITA..

shez1983 left a reply on HasManyThrough 4 Tables ? • 3 weeks ago

you have two choices afaik:

  1. dont have this fourth table - just use product and add in external_id (assumes it come from api) and external_type(shopify, magento etc) because a product can only ever come from external OR internal ?

  2. if you want the current setup look up VIEWS.. create a view (join two tables together, in the end you are doing above) in mysql & in LARAVEL treat it like a table..

28th April, 2018

shez1983 left a reply on Argument 1 Passed To Illuminate\Auth\SessionGuard::login() Must Be An Instance Of Illuminate\Contracts\Auth\Authenticatable, Instance Of App\User Given, Called • 4 weeks ago

you seriously need to go back to basics - its no good asking us to help you when you cannot read the doc/write proper code..

from your original post

request(['name','email','password']

seems to be wrong.. i wont tell you the answer as it should be obvious (even if you do not know laravel) and b) laravel docs should tell you how to do it in laravel.

27th April, 2018

shez1983 left a reply on Form Request Validates An Array • 4 weeks ago

try

 return [
            'user.*.id'               => 'required' ,
            'user.*.status'       => 'required' 
        ];

shez1983 left a reply on How Does The 'associate' Method Work Behind The Scenes? • 4 weeks ago

you could always go to the associate() method in laravel framework and see what it does and whether it has permission checking etc

26th April, 2018

shez1983 left a reply on Cancelling Membership - Do You Get Your Money Back If You Paid Yearly? • 1 month ago

feel like an idiot now.. htanks :)

shez1983 started a new conversation Cancelling Membership - Do You Get Your Money Back If You Paid Yearly? • 1 month ago

as per the title - also there is no CONTACT US button on this site.. does anyone know how to contact jefferey way?

shez1983 left a reply on Problem With A Queue And Forge Workers - Restarting New Job Even After Job Does Not Fail • 1 month ago

is your handle method returning a failure try that.. ie throw an exception/return false etc..

25th April, 2018

shez1983 left a reply on How Should I Do My Project • 1 month ago

he also didnt ask about login/register/add to cart etc etc.. whats your point?

to OP:

it depends on what you are comfortable with and what you have done. if you use laravel use that, if not use whatever... same with frontend..

btw html & bootstrap != react..

if this is for a school project or a learning course then pick a backend / frontend tech you are comfortable with and start building...

shez1983 left a reply on Store New With Relation To User (vue) • 1 month ago

 $building->user()->save($user);

        $user->buildings()->associate($building);

dont seem right to me..

you dont even need to FIND the user.. just do

Auth::user()->buildings()->save($building)

OR

$building->user()->associate(\Auth::user());

not both..

notice the difference between your code & mine..

shez1983 left a reply on Problem With A Queue And Forge Workers - Restarting New Job Even After Job Does Not Fail • 1 month ago

https://laravel.com/docs/5.6/queues#dealing-with-failed-jobs

seems to confirm that failed() should be called after Maximum Tries is exhausted..

on a side note whats weird for me is that sometimes when the job goes to failed database, the failure simply says 'failed due to max timeout' instead of why it actually failed..

shez1983 left a reply on Stripe Slow • 1 month ago

i dont think he meant to post the script - how long does it take?

We are using stripe but slowness has not been an issue that we encountered... but we somehow have our own form but also use stripe somehow.. not 100% sure but i do know we dont use the popup screen that Stripe gives you if you choose to integrate like that..

i guess this doesnt answer your q but in a way it does as you can go to stripe docs and go down the custom route!

20th April, 2018

shez1983 left a reply on Is It Legal To Copy A "look" Of A Page? • 1 month ago

dont they usually have a line at the bottom of the page All rights reserved, copyrights 2018..

from my limited knowledge I have read that anything something does AUTOMATICALLY becomes owner - you cannot take their work. so a website design is 'essentially a work' done by someone - copy it at your peril..

19th April, 2018

shez1983 left a reply on Portfolio Friendly Project • 1 month ago

its not about complexity its about showing you can do stuff & more importantly your code follows the best practises.. of course a simple site (static) wont do you any favours but something like a shopping site/ forum (not too complex) can be good..

one other thing is pull requests ie. contributing to os projects..

17th April, 2018

shez1983 started a new conversation Dusk - Running Multiple Tests Break.. • 1 month ago

i have few tests - in some of them i use the PAGE (SaveCoupon) to fill out the form to keep my tests DRY - in others i dont as i dont need it.

The tests that i dont need fail if i run the whole Test Class but they pass when I run them individually.. i am not sure why but the error is that it tries to load the PAGE saveCoupon even when i do not explicitly specify it..

    public function test_i_can_delete_a_coupon() : void
    {
        $this->browse(function (Browser $browser) use ($coupon)
        {
            $browser->loginAs(Admin::first())
                ->visit('/admin/coupons');

            $browser->with('.dusk-' . $coupon->id, function ($row)
            {
                $row->press('Delete')
                    ->acceptDialog();
            });

            $browser->assertSee('Coupon was deleted');
        });
    }

8th April, 2018

shez1983 left a reply on Downgrade Form Laravel 5.6 To 5.5 • 1 month ago

dont forget to follow the upgrade guide (from 5.5 to 5.6) but in reverse...

3rd April, 2018

shez1983 left a reply on Global Variable That Gets Data From DB • 1 month ago

i think for stuff like that .env might be a better option then you can pull them in to a config/global.php file and then use then like config('global.option')

but regarding your q - yes caching is a good option and you can invalidate the cache when admin changes values (using admin panel).. to check caching just head over to docs - pretty simple.. (wrap your code in a closure and you are set to go)

shez1983 left a reply on Global Variable That Gets Data From DB • 1 month ago

global option? will this change per user or not.. if not store it in .env

in either case the real answer should be to

a) use middleware to get the values from the db.. (use caching to not do queries again and again)

b) if user options then you could extend the Register/login mechanism but in most cases you can just do AUth::user()->settings..

30th March, 2018

shez1983 left a reply on What Happens If A Laravel "synchronous" Job Fails? • 1 month ago

even though job is its own class, it should not have any logic in it in terms of doing stuff that can be done using other classes (e.g. productService/product repository etc).. it should also be as lean as possible..

shez1983 left a reply on Best Practice For Nested Resource Routing • 1 month ago

i am not sure he mentioned resources shortcuts..

but to answer your dilemma - option a is the way to go..

for resources though i wouldnt do nested resources..

shez1983 left a reply on Expiry For S3 Image • 1 month ago

expiry time for what sorry? i dont understand

29th March, 2018

shez1983 left a reply on Getting Code Cleaner • 1 month ago

With the "whereNumber-function" you mean adding dynamic Scopes? yes.

i still have no idea about what the system does and what you are trying to implement - but if it is a three stage step then have three controller methods..

shez1983 left a reply on How I Can Fix My Model • 1 month ago

i suggest you read up on the relationship in the docs!

shez1983 left a reply on PHPUnit Database Assertion Fails In PHP Storm But NOT In Terminal • 1 month ago

does it fail everytime? I ask because sometimes for me test sometimes passes and other times fails because of my incorrect SETUP routine for the test..

but it is indeed really puzzling.. maybe instead of creating, use one already in the db and echo it out and see what phpstorms dumps out and what terminal dumps out..

shez1983 left a reply on Encrypt With Laravel And Decrypt In Javascript • 1 month ago

its the same thing - its react native.. and easily debugable.. not sure why you think its different.. :s

shez1983 left a reply on Encrypt With Laravel And Decrypt In Javascript • 1 month ago

i dont think so - at least not with JS because for it to work you would need a key in the frontend afaik... to get the decrypted values in JS..

shez1983 left a reply on Return User Model • 1 month ago

i wouldnt optimise if there is no need - if the the three q are doing fine - ie no major lag then there is no problem (even if it lags very much you can build caching system)..

i think first build a system - then see where it gives you problems (be speed or otherwise)

shez1983 left a reply on Amazon AWS Aurora • 1 month ago

i am too meaning to move my db to aurora - it supports mysql 5.7 now

shez1983 left a reply on How I Can Fix My Model • 1 month ago

so in ur controller eagerload.... $s = product::with('spec.fields.values');

in blade you have to do $product->spec->fields[0]->value..

btw if fields can only have one value why not just add that to field table - why create a new one?

28th March, 2018

shez1983 left a reply on What Happens If A Laravel "synchronous" Job Fails? • 1 month ago

bobby - that would be too simple & quick - i mean isnt it better to ask on the forum, wait for someone else to reply!

shez1983 left a reply on SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column 'created_at' In 'order Clause' • 1 month ago

also if you are using order() or latest() in your query they may use created_at by default so you have to specify the column you want to order by..

shez1983 left a reply on Only Get The Id Number • 1 month ago

you pass $user_id->id to the browser...

shez1983 left a reply on Laravel Retrieve Data • 1 month ago

why are u inserting two data at the same time - usually you have a form where you register - in that case you insert my details and can get my ID.. from one of teh example given above..

with regards to YOUR scenario..

you insert the data point 1 .. and you SAVE it to a variable you insert another data... or do whatever you want...

why is this so hard?

27th March, 2018

shez1983 left a reply on Required_without... But Not Both? • 1 month ago

required_without:foo,bar,? comes to mind

shez1983 started a new conversation 5.6 - Custom Logging - Logentries Doesnt Seem To Be Working? • 1 month ago

so prior to 5.6 i did something like this in bootstrap/app.php

$app->configureMonologUsing(function($monolog) {
$logEntriesHandler = new Monolog\Handler\LogEntriesHandler(env('LOGENTRIES_TOKEN'));
    $monolog->pushHandler($logEntriesHandler);
});

and this worked - in 5.6 there is a new custom logging thing where you have to have a new logging config file, a new custom logging class

class CreateCustomLogger
{
    /**
     * Create a custom Monolog instance.
     *
     * @return \Monolog\Logger
     * @throws \Monolog\Handler\MissingExtensionException
     */
    public function __invoke()
    {
        return new Logger(new LogEntriesHandler(\config('services.logentries.token')));
    }
}

but this doesnt seem to be working for me - i dont get an error but it doesnt work. if i change my logging from custom (which is what its called) to single.. i can see it updating the file in storage/logs folder :s

26th March, 2018

shez1983 left a reply on What's The Most Affordable Way To Host Demo Laravel Apps? • 2 months ago

there is always digitalocean.. for 5£ you get 20GB and 1 GB Ram. enough for demo sites

shez1983 left a reply on Download A File From The Database • 2 months ago

try

return response()->downloadDownload($url)

one thing puzzling me is the PUBLIC folder? is there really a public folder in your STORAGE folder or are you trying to download it to public/folder in root (where all assets go after you run gulp/webpack?)

shez1983 left a reply on Items:protected • 2 months ago

i assume creator_id is in tasks?

have you not read about the with syntax with a closure?

{ 
/// do your creator_id here
}])

i dont think anyone does it like you have..

btw this lluminate\Database\Eloquent\Collection Object ( [items:protected] => Array ( ) ) doesnt look like an error? its giving you an EMPTY array?

which is correct since TAG is a new OBJECT and as such doesnt have any matching tasks..

shez1983 left a reply on CustomRequest Is Empty In 5.5 • 2 months ago

what happens when you manually validate in the controller? if that works you COULD extract that to another file (call it whateverRequest) and pass in Request and do the whole test if it passes validation manually..

25th March, 2018

shez1983 left a reply on How To Change Base Url In Laravel • 2 months ago

well normally once i get into NORMAL route all routes will automatically have normal URL links... (same with subscription) -

but if you want to change this to how you asked then you should create a session value called base_url and in the middleware, check if it exists if it does you do a config::set('base_url', 'whatever you want');

check config/app.php to see which config setting uses base_url i cant rememeber off hand

Edit Your Profile
Update

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