andylord565

andylord565

Member Since 3 Years Ago

Experience Points 15,275
Experience
Level
Lessons Completed 153
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

04 Dec
1 week ago

andylord565 started a new conversation Not Ordering Correctly

i have this code

$products = products::orderBy('id', 'ASC')->with(['onedetail' => function ($q) {
                  $q->orderBy('price', 'DESC');
                }]);

$products= $products->paginate($page);

One detail i simply a connection to more details

public function onedetail()
     {
         return $this->hasOne('App\product_price_details', 'product_id', 'id');
     }

When it comes to the ordering it is coming out in a weird order not even close has anyone any idea how to fix this ?

27 Nov
2 weeks ago

andylord565 left a reply on File Not Found At Path With Maatwebsite/excel

Try this:

Excel::import(new ProductsImport, public_path('excel_products/'.$excel->name));

23 Nov
2 weeks ago

andylord565 started a new conversation Foundation, Bootstrap Or Other

I use bootstrap a lot unless fully customizing sites from scratch but looking for alternatives and come across foundation.

My question is what do you use and recommend for a CSS framework for quick medium and large sites?

03 Nov
1 month ago

andylord565 left a reply on Method Links Does Not Exist In Laravel 5.6 App?

on SearchController change $vehicles = Vehicle::get(); to $vehicles = Vehicle::paginate();

also

``$vehicles = Vehicle::search($request->get('search'))->paginate()->sort(function ($a, $b) { if ($a->adtype !== $b->adtype) { return $b->adtype - $a->adtype; }

    return $a->adtype
        ? ($a->updated_at->gt($b->updated_at) ? -1 : 1)
        : ($a->created_at->gt($b->created_at) ? -1 : 1);
});  

``

01 Nov
1 month ago

andylord565 left a reply on Why Did Not Laravel 5.6 Active Menu Item Highlight Using Request?

@Analmax

For 5.6 it is the following

{{ Request::is('products/*') ? 'active' : '' }} or {{ Request::is('products') ? 'active' : '' }}

31 Oct
1 month ago

andylord565 left a reply on Why Did Not Laravel 5.6 Active Menu Item Highlight Using Request?

Use {{ Route::is('products.*') ? 'active' : null }}

14 Oct
1 month ago

andylord565 left a reply on Is There A Way To Keep Page From Expiring

You can change the timeout in config\session.php

although i would not change this to something to big for security.

25 Sep
2 months ago

andylord565 left a reply on Routing Active

Just to update this for future i found that this is for 5.6: {{ Request::is('news/*') ? 'active' : '' }}

11 Sep
3 months ago

andylord565 left a reply on Laravel Collection Ordering Bring To Front

@Mo7sin yes exactly but with values already in the collection is there a way to prepend results based on a where for example

andylord565 started a new conversation Laravel Collection Ordering Bring To Front

How would one bring certain results in a collection to the front of the collection say if field A = 0 or A = 1 ?

27 Jul
4 months ago

andylord565 left a reply on Laravel Upload Image Validation Failed | Hacking Threat

change 'image' => 'mimetypes:jpeg,png,jpg', to 'image' => 'mime:jpeg,png,jpg'

That should work

01 Jun
6 months ago

andylord565 left a reply on Routing Active

Neither of these work and route is not named.

andylord565 started a new conversation Routing Active

In Laravel 5.2 this is working: {{ Route::is('mylink.*') ? 'active' : null }} In Laravel 5.5/5.6 this is now working does anyone know why or a way to fix ?

15 Mar
8 months ago

andylord565 left a reply on Laravel And Git

Update i just tried a fresh install of Laravel and route:list is working fine although only a few routes leading me to believe something is wrong on Laravels side

andylord565 left a reply on Laravel And Git

@Sergiu17 Its already set to xterm-256color This has no affect I was using version 2.16.2 and now tried version 2.10 as i just recently upgraded but this did not fix it unfortunatly

14 Mar
8 months ago

andylord565 left a reply on Laravel And Git

Reinstalling Git has not fixed this issue anyone any ideas ?

andylord565 left a reply on Laravel And Git

Using another terminal is working totally fine and the same setup and project on another computer this is not happening weird.

andylord565 left a reply on Laravel And Git

@Sergiu17 Still the same with that command

andylord565 started a new conversation Laravel And Git

Has anyone ever come across this before only happens in Git and when doing route:list? https://ibb.co/hwgTVH

13 Mar
8 months ago

andylord565 started a new conversation Mailgun Sending

Emails are not sending My Env is Digital ocean. What i have done/checked: -- added config/services mailgun -- changed .env to mailgun -- checked that guzzle is working

No errors occur when doing the following

Route::get('send_test_email', function(){ Mail::raw('Sending emails with Mailgun and Laravel is easy!', function($message) { $message->subject('Mailgun and Laravel check'); $message->from('[email protected]', 'Website Name'); $message->to('[email protected]'); }); }); No error logs are stored in var and laravel.log is empty. On Mailguns side it is showing no emails coming through any ideas what could be going wrong ?

20 Aug
1 year ago

andylord565 started a new conversation Faker Random Image Size Width And Height

My Factory currently is:

$factory->define(App\gallery::class, function (Faker $faker) { return [ 'image' => $faker->randomElement(['150x350.png' ,'150x500.png', '350x150.png', '350x350.png', '500x150.png']),

];

}); I am after: $factory->define(App\gallery::class, function (Faker $faker) { return [ 'image' => $faker->randomElement(['150x350.png' ,'150x500.png', '350x150.png', '350x350.png', '500x150.png']), 'height' => heighthere, 'width' => widthhere, ]; });

But i the height and width need to match the randomElement size selected how can i do this ?

12 May
1 year ago

andylord565 left a reply on Laravel Compression

https://jsfiddle.net/vLah664a/ See link for my current htaccess

andylord565 left a reply on Laravel Compression

Below is my htaccess Options -MultiViews

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding

AddOutputFilterByType DEFLATE application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/html text/plain text/x-component text/xml

Header set X-UA-Compatible "IE=Edge,chrome=1"

mod_headers can't match by content-type, but we don't want to send this header on everything...

<FilesMatch ".(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" > Header unset X-UA-Compatible

# mod_headers, y u no match by Content-Type?! <FilesMatch ".(gif|png|jpe?g|svg|svgz|ico|webp)$"> SetEnvIf Origin ":" IS_CORS Header set Access-Control-Allow-Origin "*" env=IS_CORS

<FilesMatch ".(ttf|ttc|otf|eot|woff|font.css)$"> Header set Access-Control-Allow-Origin "*"

<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$"> Header set Cache-Control "public"

ExpiresActive on

ExpiresDefault "access plus 1 month"

ExpiresByType text/cache-manifest "access plus 0 seconds"

ExpiresByType text/html "access plus 0 seconds"

ExpiresByType text/xml "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType application/json "access plus 0 seconds"

ExpiresByType application/rss+xml "access plus 1 hour" ExpiresByType application/atom+xml "access plus 1 hour"

ExpiresByType image/x-icon "access plus 1 week"

ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType video/ogg "access plus 1 month" ExpiresByType audio/ogg "access plus 1 month" ExpiresByType video/mp4 "access plus 1 month" ExpiresByType video/webm "access plus 1 month"

ExpiresByType text/x-component "access plus 1 month"

ExpiresByType application/x-font-ttf "access plus 1 month" ExpiresByType font/opentype "access plus 1 month" ExpiresByType application/x-font-woff "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

ExpiresByType text/css "access plus 1 year" ExpiresByType application/javascript "access plus 1 year"

andylord565 started a new conversation Laravel Compression

Compressing http://example.co.uk/ could save 7.2KiB (70% reduction).

I am running compression through htaccess I have added all the usual htaccess rules however the actual page it is on is not compressing anyone know why this is?

22 Nov
2 years ago

andylord565 left a reply on Laravel Relationship Not Working?

I figured this out and the controller had to be more specific like this: $cart = carttemp::where('session_id', '=', $session_id)->with('getproducts')->get();

andylord565 left a reply on Laravel Relationship Not Working?

Also it just came to mind but could it be something to with my controller?

this is how i am getting the cart: $cart = DB::table('carttemp')->where('session_id', '=', $session_id)->get();

andylord565 left a reply on Laravel Relationship Not Working?

could it be in the way i have done the databases?

carttemp: id, products_id, session_id, quantity

products id, name etc

andylord565 left a reply on Laravel Relationship Not Working?

yes cart object is firing just fine

andylord565 started a new conversation Laravel Relationship Not Working?

Why is my relationship not working? First time i have actually tried doing this so little confusing basically i need to foreach products from the cart this is what i have:

@foreach ($cart->getproducts as $carttemp) product info goes here @endforeach

This is on my carttemp model:

public function getproducts() { return $this->belongsToMany('App\products', 'products', 'products_id', 'id'); } This is on products Model: public function carttemp() { return $this->hasMany('App\carttemp'); }

Why is it bringing back a error: Trying to get property of non-object

08 Nov
2 years ago

andylord565 left a reply on Laravel 5.2 Errors Not Showing And Route Model Binding

So rather then messing around with this i just reinstalled a fresh laravel and added all the content back to it and it fixed it no idea what the cause was

andylord565 started a new conversation Laravel 5.2 Errors Not Showing And Route Model Binding

so recently i upgraded a build to 5.2 which was great however now what i get is that pages no longer show the errors page or a nice sorry page anymore just a blank page on top of this i am trying to add a route model binding:

In route service provider i added this: $router->model('slug', 'App\blog');

and in my route this: Route::get('/blog/{slug}', '[email protected]');

However i am just getting a white page and on the console i can see the error 404 so little confused as to how to fixed this at the moment anyone can help here please?

09 Oct
2 years ago

andylord565 left a reply on Shared Hosting Request

Figured it out http should be Http

andylord565 started a new conversation Shared Hosting Request

Anyone have any idea why my request would not work on shared hosting:

ReflectionException in Route.php line 286: Class App\http\Requests\blogRequest does not exist

I checked the file location and it is in place

23 Aug
2 years ago

andylord565 started a new conversation Vue Hot Reloading

Anyone have any tutorials on Hot reloading in Vue, going through the documents and wishing there was a video i could follow by Jeffery

31 Mar
2 years ago

andylord565 left a reply on Project Flyer No Refresh

"If you want to upload then display. Return all images in the API post request. On success use JavaScript to display the images/replace image list area or refresh the page."

@jekinney as i am not sure how to do this do you have an example please?

30 Mar
2 years ago

andylord565 left a reply on Project Flyer No Refresh

anyone can help with this?

andylord565 started a new conversation Project Flyer No Refresh

Just been watching this series again as i remembered hearing in this series that after uploading it would show the thumbnails without refreshing and i was interested to see how Jeffery did this but i see this has not been done as of yet in the series has anyone managed to do this and have an example ?

26 Mar
2 years ago

andylord565 left a reply on New Design...

Just seen the new design, not a fan of having to click more from the homepage to find what i want, can you bring back some kind of menu on the homepage please!

22 Mar
2 years ago

andylord565 started a new conversation Session Logins

So basically i just thought i had found a security flaw in a website being developer but not sure basically when logged in you set a session for the logged in user as the username now if someone was to set the same session on in a similar way on a different website that session would be set and they would be logged in on both sites correct ? does that make sense if not please ask

so basically what is the best way of stopping this or how else would you do it?

15 Mar
2 years ago

andylord565 left a reply on Uploading CSV

@Snapey yes i have i just figured it out i had not added the titles in the csv so it could not read it Thanks for the help

andylord565 left a reply on Uploading CSV

Thanks @Snapey its now uploading and adding them however the fields are blank

andylord565 started a new conversation Uploading CSV

View:

@extends('layouts.suplayout')

@section('content')
<h1>CSV Upload</h1>

@include ('errors.list')
{!! Form::open(array('method' => 'POST','url' => 'uploadexcel')) !!}
<div class="form-group">
{!! Form::file('file') !!}
</div>
<div class="form-group">
{!! Form::submit('Add', ['class' => 'btn btn-primary form-control']) !!}
</div>
{!! Form::close() !!}



@stop

controller method:

public function csvupload()
{
return view('superadmin.csvupload');

}
public function upload()
{
    $rules = array(
        'file' => 'required',
        //'num_records' => 'required',
    );

    $validator = Validator::make(Input::all(), $rules);
    // process the form
    if ($validator->fails()) 
    {
        return Redirect::to('sales')->withErrors($validator);
    }
    else 
    {
        try {
            Excel::load(Input::file('file'), function ($reader) {

                foreach ($reader->toArray() as $row) {
                    sales::Create($row);
                }
            });
            \Session::flash('success', 'Sales uploaded successfully.');
            return redirect(route('sales'));
        } catch (\Exception $e) {
            \Session::flash('error', $e->getMessage());
            return redirect(route('sales'));
        }
    } 
} 

routes:

Route::get('superadmin/csvupload', 'SuperAdminController@csvupload');
Route::post('uploadexcel', 'SuperAdminController@upload');

I am doing the above and uploading a CSV however when doing so it brings no errors nothing anyone know why this is happening or how to fix this??

11 Mar
2 years ago

andylord565 started a new conversation Sending Two Emails

This function is sending both emails instead of the empty or other

 public function emailReminder()
    {
        //$sales = sales::findOrFail(14);
        $sales = sales::where('callback', '=', Carbon::today()->format('Y-m-d'))->where('salesrep', '=', 'Brandon')->get();
if($sales->isEmpty()){
  //dd("nosales");  
  $sales = "nosales"; 
 Mail::send('emails.reminder', ['sale' => $sales], function ($m) use ($sales) {
           
            $m->from('email@email.com', 'Phone call reminders');
            $m->to('email@email.com')->subject('no sale calls today!');


        });   
}
//$data = templates::findOrFail(1);
        //dd($sales);
    Mail::send('emails.reminder', ['sale' => $sales], function ($m) use ($sales) {
           
            $m->from('email@email.com', 'Phone call reminders');
            $m->to('email@email.com')->subject('Your sale Phone call reminders 110!');


        });

    
    }

What am i doing wrong here ?

10 Mar
2 years ago

andylord565 started a new conversation CronJob Not Running

I have this cron setup but its not running :

*   *   *   *   *   php /home/wwwwbpsalesco/artisan schedule:run >> /dev/null 2>&1

Is there anything i can do to test why its not running or is something wrong ?

09 Mar
2 years ago

andylord565 left a reply on How To Check If Empty

@willvincent that doesnt seem to work either in dd(); i get items[]; instead of the text

andylord565 started a new conversation How To Check If Empty

how can i check if there is no results from this ?

        $sales = sales::where('callback', '=', Carbon::today()->format('Y-m-d'))->get();

i thought it would be something along these lines but no luck

if($sales == ""){

    $sales = "nosales";
}

andylord565 left a reply on Dates Carbon Carbon

figured this out just needed to change it to so it has ->format('Y-m-d') on the end

andylord565 started a new conversation Dates Carbon Carbon

i am using this code to find a date:

$sales = sales::where('callback', '=', Carbon::today())->get();

now this will find any dates like this: 2016-03-09 00:00:00

How can i find dates that are are todays date like this: 2016-03-09

03 Mar
2 years ago

andylord565 left a reply on Chartjs Lists

@willvincent this is what is confusing me also

andylord565 started a new conversation Chartjs Lists

I am getting this odd data from using the code below anyone know how to stop this?

var data = {
    labels: [{&quot;date&quot;:&quot;2016-02-24 00:00:00&quot;,&quot;timezone_type&quot;:3,&quot;timezone&quot;:&quot;UTC&quot;}]
    ],
$allsold =sales::where('status', '=', 'sold')->get();
->with('dates', $allsold->lists('created_at'));