Member Since 3 Years Ago
2,155 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
andylord565 left a reply on HTML 5 Video And Laravel
php artisan storage:link
creates a symbolic link more details found here: https://laravel.com/docs/5.7/filesystem
<video src="{{ asset('storage/movie.mp4') }}" width="100%" height="100%" controls>
</video>
The above should work
Try this:
<video src="{{url('')}}/storage/movie.mp4" width="100%" height="100%" controls>
</video>
or move the mp4 into the public folder.
andylord565 left a reply on Policies Help
Anyone having the same problem in the future managed to fix this:
public function __construct()
{
$this->middleware(function ($request, $next) {
$user= Auth::user();
$auth = $this->authorize('view', \App\groups::class, $user);
});
}
andylord565 started a new conversation Policies Help
The following works
public function index()
{
$this->authorize('view', groups::class);
$groups = groups::orderBy('id', 'DESC')->get();
return view('admin.groups.index', compact('groups'));
}
The following does not:
public function __construct()
{
$auth = $this->authorize('view', App\groups::class);
}
View file on App/Policies
public function view(User $user)
{
dd();
}
How can i get it to work on a constructor rather then every function ?
andylord565 left a reply on Laravel - View Not Found
@programeranel please display your edit blade file to debug
andylord565 left a reply on Using Factories To Seed Sub-relations
That would work i would recommend the table change however for relational and future work. Solution found is good though!
andylord565 left a reply on Validating A Request() With Key, Value Pairs
Hi @dawgonking try this
"scales" => "required|integer|between:1.15",
"scales.*" => "required|numeric|between:2,4",
andylord565 left a reply on Using Factories To Seed Sub-relations
do something like this
factory(App\Asset::class, 1000)->create()->each(function ($asset) {
factory(\App\AssetType::class, 1000)->create(['asset_id'=>$asset->id]);
factory(\App\AssetModel::class, 1000)->create(['asset_id'=>$asset->id]);
});
andylord565 left a reply on Read More In Paragraph
\Illuminate\Support\Str::words($value, $words = 100, $end = '...')
\Illuminate\Support\Str::limit($value, $limit = 100, $end = '...')
limit the words or the String and add a link on the end
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 ?
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));
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?
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);
});
``
andylord565 left a reply on Why Did Not Laravel 5.6 Active Menu Item Highlight Using Request?
For 5.6 it is the following
{{ Request::is('products/*') ? 'active' : '' }}
or
{{ Request::is('products') ? 'active' : '' }}
andylord565 left a reply on Why Did Not Laravel 5.6 Active Menu Item Highlight Using Request?
Use {{ Route::is('products.*') ? 'active' : null }}
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.
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' : '' }}
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 ?
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
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 ?
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
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
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 ?
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 ?
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"
<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?
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
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?
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
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
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?
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 ?
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!
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?
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??