andylord565

Experience

14,705

0 Best Reply Awards

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

27th July, 2018

andylord565 left a reply on Laravel Upload Image Validation Failed | Hacking Threat • 3 weeks ago

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

That should work

1st June, 2018

andylord565 left a reply on Routing Active • 2 months ago

Neither of these work and route is not named.

andylord565 started a new conversation Routing Active • 2 months ago

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 ?

15th March, 2018

andylord565 left a reply on Laravel And Git • 5 months ago

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 • 5 months ago

@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

14th March, 2018

andylord565 left a reply on Laravel And Git • 5 months ago

Reinstalling Git has not fixed this issue anyone any ideas ?

andylord565 left a reply on Laravel And Git • 5 months ago

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 • 5 months ago

@Sergiu17 Still the same with that command

andylord565 started a new conversation Laravel And Git • 5 months ago

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

13th March, 2018

andylord565 started a new conversation Mailgun Sending • 5 months ago

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 ?

20th August, 2017

andylord565 started a new conversation Faker Random Image Size Width And Height • 11 months ago

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 ?

12th May, 2017

andylord565 left a reply on Laravel Compression • 1 year ago

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

andylord565 left a reply on Laravel Compression • 1 year ago

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 • 1 year ago

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?

22nd November, 2016

andylord565 left a reply on Laravel Relationship Not Working? • 1 year ago

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? • 1 year ago

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? • 1 year ago

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? • 1 year ago

yes cart object is firing just fine

andylord565 started a new conversation Laravel Relationship Not Working? • 1 year ago

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

8th November, 2016

andylord565 left a reply on Laravel 5.2 Errors Not Showing And Route Model Binding • 1 year ago

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 • 1 year ago

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?

9th October, 2016

andylord565 left a reply on Shared Hosting Request • 1 year ago

Figured it out http should be Http

andylord565 started a new conversation Shared Hosting Request • 1 year ago

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

23rd August, 2016

andylord565 started a new conversation Vue Hot Reloading • 1 year ago

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

31st March, 2016

andylord565 left a reply on Project Flyer No Refresh • 2 years ago

"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?

30th March, 2016

andylord565 left a reply on Project Flyer No Refresh • 2 years ago

anyone can help with this?

andylord565 started a new conversation Project Flyer No Refresh • 2 years ago

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 ?

26th March, 2016

andylord565 left a reply on New Design... • 2 years ago

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!

22nd March, 2016

andylord565 started a new conversation Session Logins • 2 years ago

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?

15th March, 2016

andylord565 left a reply on Uploading CSV • 2 years ago

@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 • 2 years ago

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

andylord565 started a new conversation Uploading CSV • 2 years ago

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??

11th March, 2016

andylord565 started a new conversation Sending Two Emails • 2 years ago

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 ?

10th March, 2016

andylord565 started a new conversation CronJob Not Running • 2 years ago

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 ?

9th March, 2016

andylord565 left a reply on How To Check If Empty • 2 years ago

@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 • 2 years ago

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 • 2 years ago

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 • 2 years ago

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

3rd March, 2016

andylord565 left a reply on Chartjs Lists • 2 years ago

@willvincent this is what is confusing me also

andylord565 started a new conversation Chartjs Lists • 2 years ago

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'));

2nd March, 2016

andylord565 started a new conversation Form Update Request If Statement • 2 years ago

i am using the below code

$update = Request::all();

if($update['status']='lost')
{
    //
$update['callback'] = '-';
}

dd($update);

now what i am trying to achieve is if the submitted request for status equals lost then the callback would be blank but no matter what happens on the submit status is set to lost and callback - what am i doing wrong here?

1st March, 2016

andylord565 left a reply on Datatables Row Details • 2 years ago

anyone able to to help with this or need anymore details ?

29th February, 2016

andylord565 started a new conversation Datatables Row Details • 2 years ago

trying to add row details onto my data table from http://datatables.yajrabox.com/eloquent/row-details and getting the below error

Uncaught ReferenceError: table is not defined

I am unsure what is causing this as i have got a near exact copy of the example anyone can help with this? controller:

public function getIndex()
{
    return view('sales.index');
}

/**
 * Process datatables ajax request.
 *
 * @return \Illuminate\Http\JsonResponse
 */
public function anyData()
{
    //return Datatables::of(sales::select('*'))->make(true);

$sales = DB::table('sales')
            ->select(['status','phone','busname','contactname','secondname','notes','callback','name','source','salesrep', 'id' ]);


        return Datatables::of($sales)
            ->addColumn('action', function ($sales) {
                return '<a href="sale/'.$sales->id.'/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>
                <a href="sale/'.$sales->id.'" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-zoom-in"></i> View</a>

 <button class="btn btn-delete" data-remote="sale/' . $sales->id . '">Delete</button>
                ';
            })
            ->addColumn('phone', function ($sales) {
                return '<a href="tel:'.$sales->phone.'">'.$sales->phone.'</a>';
            })
            //->editColumn('id', 'ID: {{$id}}')
            ->make(true);
}

  public function getRowDetails()
    {
        return view('sales.row-details');
    }

    public function getRowDetailsData()
    {
       // $sales = DB::select(['notes']);
        $sales = DB::table('sales')
            ->select(['notes','id' ]);


        return Datatables::of($sales)->make(true);
    }

View:

<div class="table-responsive">
    <table class="table table-bordered" id="sales-table">
        <thead>
            <tr>
              <th></th>
                <th>Status</th>
                <th>Phone</th>
                <th>Business Name</th>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Notes</th>
                <th>Date of Callback</th>
             
                <th>Action</th>
            </tr>
        </thead>
    </table>
</div>

@endsection

@push('scripts')
<script>
var template = Handlebars.compile($("#details-template").html());
$(function() {
    $('#sales-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: '{!! route('sales.data') !!}',
        "order": [[ 7, "asc" ]],
         columnDefs: [ {
            targets: [ 7 ],
            orderData: [ 1, 7, ]
        } ],
        columns: [
        {
                "className":      'details-control',
                "orderable":      false,
                "data":           null,
                "defaultContent": '',
        },
            { data: 'status', status: 'status' },
            {data: 'phone', name: 'phone', orderable: true, searchable: true},
            { data: 'busname', busname: 'busname' },
            { data: 'contactname', contactname: 'contactname' },
            { data: 'secondname', secondname: 'secondname' },     
              { data: 'notes', notes: 'notes' },
               { data: 'callback', callback: 'callback' },
             
                {data: 'action', name: 'action', orderable: false, searchable: false}
        ]
    });
});
$('#sales-table').on('click', '.btn-delete[data-remote]', function (e) { 
    e.preventDefault();
     $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
     
    var url = $(this).data('remote');
    // confirm then
    $.ajax({
        url: url,
        type: 'DELETE',
        dataType: 'json',
        data: {method: '_DELETE', submit: true}
    }).always(function (data) {
        $('#sales-table').DataTable().draw(false);
    });
});
 // Add event listener for opening and closing details
    $('#sales-table').on('click', 'td.details-control', function () {
//alert();
        var tr = $(this).closest(tr);
        var row = table.row(tr);

        if ( row.child.isShown() ) {
            // This row is already open - close it
            row.child.hide();
            tr.removeClass('shown');
        }
        else {
            // Open this row
            row.child( template(row.data()) ).show();
            tr.addClass('shown');
        }
    });
</script>
@endpush

row details:

<script id="details-template" type="text/x-handlebars-template">
    <table class="table">
        <tr>
            <td>Notes:</td>
            <td>{{notes}}</td>
        </tr>
        
    </table>
</script>

26th February, 2016

andylord565 left a reply on Using Views For Columns In Datatables • 2 years ago

View add this in javascript:

  {data: 'action', name: 'action', orderable: false, searchable: false}

Example of how i added edit/delete/view to one of my projects

public function anyData()
{
    //return Datatables::of(sales::select('*'))->make(true);

$sales = DB::table('sales')
            ->select(['id', 'name','source','phone','salesrep','contactname','status','notes','busname','secondname', 'callback']);


        return Datatables::of($sales)
            ->addColumn('action', function ($sales) {
                return '<a href="sale/'.$sales->id.'/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>
                <a href="sale/'.$sales->id.'" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-zoom-in"></i> View</a>

 <button class="btn btn-delete" data-remote="sale/' . $sales->id . '">Delete</button>
                ';
            })
            ->addColumn('phone', function ($sales) {
                return '<a href="tel:'.$sales->phone.'">'.$sales->phone.'</a>';
            })
            //->editColumn('id', 'ID: {{$id}}')
            ->make(true);
}

Example of my delete java in the view

$('#sales-table').on('click', '.btn-delete[data-remote]', function (e) { 
    e.preventDefault();
     $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
     
    var url = $(this).data('remote');
    // confirm then
    $.ajax({
        url: url,
        type: 'DELETE',
        dataType: 'json',
        data: {method: '_DELETE', submit: true}
    }).always(function (data) {
        $('#sales-table').DataTable().draw(false);
    });
});

Any questions i will try to answer later

23rd February, 2016

andylord565 left a reply on Lavacharts Help • 2 years ago

yea i have one commented out yet this still does not

andylord565 started a new conversation Lavacharts Help • 2 years ago

using lavacharts but getting error think im missing something examples arent that great on documentation: controller:

   public function index() {


$votes  = Lava::DataTable();

$votes->addStringColumn('Food Poll')
      ->addNumberColumn('Votes')
      ->addRow(['Tacos',  rand(1000,5000)])
      ->addRow(['Salad',  rand(1000,5000)])
      ->addRow(['Pizza',  rand(1000,5000)])
      ->addRow(['Apples', rand(1000,5000)])
      ->addRow(['Fish',   rand(1000,5000)]);

Lava::BarChart('Votes', $votes);

return view('charts.index');

}
}

view:

@extends('layouts.suplayout')

@section('content')

<div id="poll_div"></div>
// With Lava class alias
<?= Lava::render('BarChart', 'Food Poll', 'poll_div') ?>

// With Blade Templates
@barchart('Food Poll', 'poll_div')

@stop

error:

BarChart('Food Poll') was not found. 

22nd February, 2016

andylord565 started a new conversation Email Variable • 2 years ago

Using the below to put the data into the email but getting error : controller function:

public function sendwelcome($id)
{
$sales = sales::findOrFail($id);
//dd($sales);
$data = array(
    'detail'=>'Your awesome detail here'
);


Mail::send('emails.welcome', ['user' => $sales], function ($m) use ($sales, $data) {
           
            $m->from('myemail', 'Your Application');
            $m->to($sales->email, $sales->name)->subject('Your welcome email!');


        });
return redirect('mysales');

}

view:

<html lang="en-US">
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        
        <div>{{ $data -> detail }}</div>
        </body>
</html>

error:

Undefined variable: data

cant figure out what im doing wrong help please

11th February, 2016

andylord565 started a new conversation Date Form • 2 years ago

https://laravelcollective.com/docs/5.2/html#date

Just added this date function onto my form but struggling to see how to add a class to this how would i do this ??

andylord565 left a reply on Show Page Not Showing Any Data • 2 years ago

@Mo7sin all i get is

[]

10th February, 2016

andylord565 left a reply on Show Page Not Showing Any Data • 2 years ago

also to further look at the issue doing:

public function show(sales $sales)
{
    $sale = sales::all();
    return view('sales.show', compact('sale'));
}

i get this http://pastebin.com/5bni5Xht

Edit Your Profile
Update

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