Snapey

at Novate / Microlise

Hire Me

Experience

960,315

1383 Best Reply Awards

  • Member Since 4 Years Ago
  • 937 Lessons Completed
  • 1 Favorite

22nd August, 2018

Snapey left a reply on Difference Results Between Eloquent And DB Builder Queries ! • 56 minutes ago

They will return the same results given the same $id so you have to assume that in one situation the id is not being set correctly.

Thats other code that we cannot see

Snapey left a reply on Any Way To Write This Return Statement Shorter • 59 minutes ago

I'm not a fan of else , if is fine.

Snapey left a reply on How To Solve Trying To Get Property 'name' Of Non-object • 1 hour ago

$user is null or it is not an object (for instance, it is an array)

You need to show how you set $user

Snapey left a reply on Any Way To Write This Return Statement Shorter • 1 hour ago

The accepted answer might be shorter, but its a lot less readable.

Snapey left a reply on No Debug Page ( Debug Is True ) • 1 hour ago

@Talinon spotted your error and should be credited

Snapey left a reply on Ajax Requests From Localhost To Remote Server • 1 hour ago

When you send ajax request from a web client, the client knows to send the server the session cookie in order to identify itself and to keep the same session.

When you are sending a request server to server, are you sending the session cookie that the remote system gave you with your first request.

Ideally all server to server communications would be stateless and use something like passport to authorize the action.

Snapey left a reply on Model • 1 hour ago

You want to know what it means?

Snapey left a reply on How To Solve Trying To Get Property 'name' Of Non-object • 1 hour ago

I know your problem,

You have to write your code like this;

and then adjust your view like this;

See what I mean?

Snapey left a reply on Difference Results Between Eloquent And DB Builder Queries ! • 1 hour ago

Please format your code by putting 3 backticks ``` on a line before and after each code block

Snapey left a reply on How Can I Send A Blank Email? • 1 hour ago

if I send an email with no contents, it gives me an error message.

That error message might be relevant...

21st August, 2018

Snapey left a reply on Duplicate Failed Due To A Cut Column Name • 11 hours ago

its perhaps just a limitation of the dd command.

Assume the attribute is ok and move on

Snapey left a reply on Custom Login Attempts Message • 1 day ago

Standard auth does not count login attempts. It has rate limiting but that is not the same thing.

Are you wanting someone to write logic for login attempts?

Snapey left a reply on Laravel - Browser Gives 404 When Image Path Correctly Defined • 1 day ago

perhaps a permissions problem?

If apache, try from the root folder of your project;

chgrp -R www-data storage 
chmod -R ug+rwx storage

20th August, 2018

Snapey left a reply on Custom Request Class Not Found On VPS • 1 day ago

dunno then. Its normally composer dump or a case sensitivity.

Does it appear in vendor/composer/autoload_classmap.php

Snapey left a reply on Laravel - Browser Gives 404 When Image Path Correctly Defined • 1 day ago

Are you seeing this 404 in the network tools or a 404 page?

Snapey left a reply on Duplicate Failed Due To A Cut Column Name • 1 day ago

I tested this and doing what you are doing, with a field that has a name of more than 30 characters works fine (when using replicate())

Is this column part of an index or has unique rule?

What error do you get?

Snapey left a reply on Re-direct To Custom URL After Login From Specific URL Logic Needed • 1 day ago

Put the other page in a group with Auth middleware. Instead of linking to the login page, link to the protected page. When the user tries to access that page then they are taken to login. They login and are redirected to the protected page.

Unless you have broken the intended function with your redirect to dashboard then this should work out of the box.

Snapey left a reply on No Debug Page ( Debug Is True ) • 1 day ago

open tinker on the server and type config('app.debug')

You can then see what the application thinks the debug mode is.

There can be two sources for the flag - the .env file and the config element itself. Check what you have in both places. A setting in .env should override the config/app.php setting.

Snapey left a reply on Custom Request Class Not Found On VPS • 1 day ago

And the request file and path is exactly App\Http\Requests\Dashboard\Employees\GetEmployeesTableRequest.php

Snapey left a reply on DB::commit Not Apply • 1 day ago

Just to check, you are not cacheing the database at all?

Also, when creating new ChatMessage, if not using queues then this thread will halt until the message has been broadcast to the client

As we don't know what new ChatMessage does, and in what order then the timings cannot be evaluated.

To answer your question, php is single threaded so nothing in this request is async - its all synchronous. The other client will start its own request and the webserver will in some way divide its time between the two.

Snapey left a reply on DB::commit Not Apply • 2 days ago

do your updates before advising the other client ?

Snapey left a reply on How To Solve MethodNotAllowedHttpException In RouteCollection.php Line 218:? • 2 days ago

@Kenshirou The error is because you do not have a GET route for tickets.

So after saving, you redirect to a route that the router recognises but the verb is wrong. It knows you have a tickets route but it is POST.

Not sure where you want to go, but normally a get to tickets would hook up with the index function.

Snapey left a reply on Custom Request Class Not Found On VPS • 2 days ago

You have gone from a case-insensitive development environment to a case-sensitive production environment

A common issue is having the wrong letter case somewhere.

19th August, 2018

Snapey left a reply on Handling Images In A Scalable Way. • 2 days ago

dont overlook spatie media manager. it will solve most of your concerns and also deal with responsive and progressive images

18th August, 2018

Snapey left a reply on Is There A Way To Randomize Css Classes In Laravel • 3 days ago

if its only some classes, you could put them in your master layout in a <style> tag

By doing it this way you can use blade within the css itself.

Suppose you use a view composer to share a random token with the view, you can then use it in both the style section in the master and in the body of the view

Suppose your token was held in $css and you wanted to randomise the class name used in a div

<style>
    .card{{$css}} {border-color:#bada55;}

    /* add as many styles as you like here using the same approach */

</style>


Later in ther view ....

<div class=".card{{$css}}">

Snapey left a reply on Where Are Registration And Login Forms For Ver 5.0?? • 3 days ago

im nice to everyone ;-). (unless they tell me to shutup)

Snapey left a reply on Send Data From Blade Form View To External POST • 3 days ago

Its your grandpa's php then...

Snapey left a reply on Anyone Know How To Display It In A Row ? • 3 days ago

@cronix, ah I've never needed that - clever b'stards these Laravel folk!

Snapey left a reply on Error With Auth Setup • 3 days ago

As I mentioned, your webserver cannot talk to the database. To help further we would need to know what server you are using

Snapey left a reply on Mailable: Non Numeric Value Encountered • 3 days ago

Because your mailable is told to expect something and you are not giving it.

Remove mailable's expectation.

Change the constructor of the mailable


public function __construct($quotation) // remove QuotationController 
{
    $this->quote = $quotation;
}

Call the mailable like this;

   Mail::to($customer['email1'])->send(new SendCustomerQuote('a temporary string'));

You are just passing a variable into a class. Its basics! Stop thinking about it as a mailable and just think 'right, i just need to pass x to this function'

Snapey left a reply on Error With Auth Setup • 3 days ago

You don't have mysql setup correctly for your webserver. File not found means that PDO is not installed.

Snapey left a reply on Anyone Know How To Display It In A Row ? • 3 days ago

@foreach ($invites as $invited)
    <?php $outerloop = $loop ?>
    @foreach($invited->apply as $applicant)
        <tr>
            @if($loop->first)       // only print number and title on first loop of applicant
                <td class="text-center">{{ $outerloop->iteration }}</td>
                <td> {{ $invited->project_title}} </td>
            @else
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            @endif
            <td>
                <a href="" class="btn btn-primary"><strong></strong> {{ $applicant->user->fname}} {{ $applicant->user->lname}} </a>
            </td>
            <td class="text-center">
                @if($applicant->apply_status== '1')
                    <label class="label label-warning">Pending</label>
                @elseif($applicant->apply_status == '0')
                    <label class="label label-danger">Rejected</label>
                @else
                    <label class="label label-success">Approved</label>
                @endif 
            </td>
            
            <td class="text-center" @if($applicant->apply_status == 1 || $applicant->apply_status == 0)>
                <form action="{{ action('TeamFinder\[email protected]', $applicant['id'] ) }}" method="post">
                    @csrf
                    <input name="_method" type="hidden" value="DELETE">
                    <button data-toggle="tooltip" title="Delete" class="btn btn-effect-ripple btn-xs btn-danger"><i class="fa fa-times"></i></button>
                </form>
            @endif
            </td>
        </tr>
    @endforeach
@endforeach

Snapey left a reply on Send Data From Blade Form View To External POST • 3 days ago

yes but you are not posting anything that can be commented on. You just show a load of variables being assigned in php.

Snapey left a reply on Call To A Member Function GetClientOriginalName() On Null • 3 days ago

There are so many tutorials and previous questions about adding images.

Sorry, I'm bored answering these.

Snapey left a reply on Retrieving Table Results By Category Name Instead Of Category Id • 4 days ago

public function index()
{
        $category = ProductCategory::with('products')
            ->where(productcategory->name, 'Starters')
            ->get();
}

now access as $category->products and you still have all the attributes of category available as well

or just products, use whereHas

    $starterProducts = Product::wherehas('productCategory',function($query) {
        $query->where('name','Starters');
      })->get();

Snapey left a reply on Call To A Member Function GetClientOriginalName() On Null • 4 days ago

we cannot see any code

Snapey left a reply on How Not To Conflict The Route • 4 days ago

whats the question and why do you need both delete and destroy methods?

Snapey left a reply on Best Way To Bisect Two Large Collections • 4 days ago

its not an n+1 issue, you are just trying to generate a dropdown with several thousand items

Just have a rethink about what you are trying to ask the user to do.

Snapey left a reply on Changing Published Vendor Assets Doesn't Change A Thing • 4 days ago

vendor files should be published to a public location or included in a build step eg Laravel mix

Snapey left a reply on Mailable: Non Numeric Value Encountered • 4 days ago

@jimmck stop keep going on about urls - you are just confusing things. We have not got to handling links in emails yet. This question is JUST about successfully calling the mailable and sending the email.

17th August, 2018

Snapey left a reply on Report Error Page • 4 days ago

white screen usually means that the laravel log file cannot be written to by the webserver.

Its a permissions and file ownership issue.

Solving this depends on your environment

Snapey left a reply on Changing Published Vendor Assets Doesn't Change A Thing • 4 days ago

then you have published your laravel application wrong. You should have public as the Document Root and everything in the vendor folder should be inaccessible from the browser

Snapey left a reply on Mailable: Non Numeric Value Encountered • 4 days ago

here in your mailable

public function __construct(QuotationController $quotation)
    {
        $this->quote = $quotation;
    }

you are saying that the mailable MUST be passed an instance of QuotationController

YOU decide what you want as the parameters for the mailable. If you only want a string then remove the reference to QuotationController and just pass $ref

Its up to you.

Snapey left a reply on Changing Published Vendor Assets Doesn't Change A Thing • 4 days ago

it cannot use the files from the vendor folder as it is not accessible on the public side

Snapey left a reply on Changing Published Vendor Assets Doesn't Change A Thing • 4 days ago

if you have published the package assets then it should not be using the one in the vendor folder any more.

Edit Your Profile
Update

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