shez1983

Experience

69,615

70 Best Reply Awards

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

26th April, 2018

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

feel like an idiot now.. htanks :)

shez1983 started a new conversation Cancelling Membership - Do You Get Your Money Back If You Paid Yearly? • 15 hours 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 • 17 hours 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 day 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 day 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 day 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 day 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? • 6 days 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 week 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 week 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 • 2 weeks 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 • 3 weeks 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 • 3 weeks 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? • 3 weeks 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 • 3 weeks 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 • 3 weeks ago

expiry time for what sorry? i dont understand

29th March, 2018

shez1983 left a reply on Getting Code Cleaner • 4 weeks 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 • 4 weeks 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 • 4 weeks 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 • 4 weeks 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 • 4 weeks 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 • 4 weeks 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 • 4 weeks 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 • 4 weeks 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? • 4 weeks 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' • 4 weeks 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 • 4 weeks ago

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

shez1983 left a reply on Laravel Retrieve Data • 4 weeks 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? • 4 weeks ago

required_without:foo,bar,? comes to mind

shez1983 started a new conversation 5.6 - Custom Logging - Logentries Doesnt Seem To Be Working? • 4 weeks 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? • 1 month 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 • 1 month 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 • 1 month 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 • 1 month 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 • 1 month 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

shez1983 left a reply on WhereRaw And Eloquence Mixed Parameters • 1 month ago

where is the eloquent code for this?

shez1983 left a reply on Broadcast And Queue Job • 1 month ago

Oberserver queue? code sample

shez1983 left a reply on Hiding Field In Resource • 1 month ago

just why are you not using the normal Resource examples provided in the docs?

you dont NEED two userCollection/userResource.. ideally just one which is used by both showing a user/showing a collection of users..

also the hidden fields are they permanently hidden OR depending on use case? if permanently then just list all of the fields -

why have you put function (UserResource $resource) use ($request) USERRESOURCE when resource is an object - so i think your solution would be to change UserResource to User type hint and inside that function new up the USerResource and pass it the object (documentation provide an example of returning a Resource...

shez1983 left a reply on Laravel Change Filesystem Disks Path On Run Time • 1 month ago

why not use the middlewares to set the path? you know who the user is so append that...

24th March, 2018

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

ok you have few issues.. but unless I know the db schema i cant help you - so here are few suggestions:

  1. as a first step move this code (inside the controller) to a service class..

  2. then refactor the code..

  3. why are you doing things like: Station::select('id')->where('number', '=', $user['number'])->first(); instead of using Eloquent Station::whereNumber($user['number'])->first(['id');

  4. you can also create a scope/helper modal function in your base MODEL class to hide this complexity so you end up with Station::func_name('column', 'value) instead of the above ie Station::select('id')->where('number', '=', $user['number'])->first();

  5. you are doing weird things station::create using num then sim number.. your db schema seems to be not correct by looking at the code

shez1983 left a reply on Hiding Field In Resource • 1 month ago

  1. that error must also tell you the line its occurring on
  2. you are using JobResource yet you show code for user collection?

shez1983 left a reply on How To Share Common Users Table For Two Laravel Applications • 1 month ago

i am not sure how you are trying to login - but you have few options:

  1. connect to the other db with users table from the first app
  2. create an api endpoint that you call (will need to override/manually create the login functionality instead of using laravel's inbuilt, or you may get by with overridding the specific function laravel calls for logging user in)
  3. share the database with both app

shez1983 left a reply on Laravel 5.5 File Fail Upload • 1 month ago

i meant UPLOAD a diff image and see if you get this error

23rd March, 2018

shez1983 left a reply on Image Not Showing 2nd Url Page • 1 month ago

so open the page up in http://localhost/site/a and do a view source and see how this is being called.. ie dump here the URL { asset() } is spewing out.. its probably doi

shez1983 left a reply on Broadcast And Queue Job • 1 month ago

the only thing I can think of is that there might be redis update which may have removed that command - or the version of package you have (predis) is old...

22nd March, 2018

shez1983 left a reply on Laravel 5.6 - Nested Eager Loading Doesn't Work In UnitTest But Work Fine In The Browser • 1 month ago

@jlrdw if you spent last time being rude and more time looking you would see second one is not a query - its a unit test GET(url) method..

i agree with tykus - verify you have all the seeders/related data available

shez1983 left a reply on HTML Formatting • 1 month ago

the final choice is YOURS though as long as you are consistent... dont spend/waste too much time on stuff like this.. just pick a standard and move on -

shez1983 left a reply on RabbitMQ Between 2+ Laravel Services • 1 month ago

you will probably need to create a console command - that continually listens to the queue.. and then do whatever you need to do - or am i over simplifying / not getting what you want.. :s

you will probably have to figure out the code on how to 'connect to rabbitMQ and get the jobs off the queue in laravel ' unless there is a package - if no package then look at the api/underlying method and build a simple functionality yourself

shez1983 left a reply on Laravel 5.5 File Fail Upload • 1 month ago

try with a diff image - do you always get this?

21st March, 2018

shez1983 left a reply on Laravel Is A Giant Waste Of Time • 1 month ago

hm.. and you brought this up AGAIN.. why?

Edit Your Profile
Update

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