akLearn

akLearn

Member Since 2 Years Ago

Experience Points 4,000
Experience
Level
Lessons Completed 32
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.

06 Oct
1 month ago

akLearn started a new conversation Zipping Files In The Bucket

Hi everyone,

I'm using DigitalOcean & they don't have an option to zip files which are in the bucket. One option is to copy these files to your server and then zip them. Next push this zip file into the bucket so users can download the zip.

My problem: I'm trying to copy the files (mp3s) from the bucket to the server. Does anyone know how to do this?

I've gotten this far...

// Stream the mp3 
$mp3 = Storage::disk('do_spaces')->get('spaces_or_bucketName');

30 Sep
1 month ago

akLearn left a reply on How To Evaluate A Design As A Project Manager?

@ Tray2 My concern is that we're blindly accepting whatever the designer makes. How do you justify the money spent on the design & whether it was worth it?

akLearn started a new conversation How To Evaluate A Design As A Project Manager?

Hi, i'm not sure, if this is the right place to be asking this question but how do project manager or even product managers evaluate a design? Is there a how to guide?

Even if you're creating your own site, how do you evaluate a design? There has to be more to it then it appealing to only you. What are the factors?

28 Jul
3 months ago

akLearn left a reply on DigitalOcean Buckets Are Slow

Thanks everyone!

So, here's what the problem was. By default anything you place in the bucket is set to private. I had written a line of code which was setting the file to public before using it in my views. Now, the setting to public line was the reason it was taking so long to load.

The minute I commented out that line everything loaded quickly.

Again, thanks everyone. Amazed at how helpful this community is.

27 Jul
3 months ago

akLearn left a reply on DigitalOcean Buckets Are Slow

I am using Intervention to resize the images. Is there an option in intervention to optimize the image?

26 Jul
3 months ago

akLearn left a reply on DigitalOcean Buckets Are Slow

Also, I loaded the page without the images and it loaded quickly. With the images it's taking too long.

akLearn left a reply on DigitalOcean Buckets Are Slow

I am checking each image to see if there's a thumbnail version of them on the server. If there isn't, then a thumbnail is generated.

That can't be the reason it's causing this much of a delay, right?

akLearn started a new conversation DigitalOcean Buckets Are Slow

I'm using DigitalOcean's spaces (buckets) to store images. When I try to retrieve them, it takes a long time. On one page i'm getting 8 images and it takes up to a minute for the page to load. The images are 260 x 260 in dimension and weigh around 40-80KB

Here's how i'm getting the images.

// to get the image's url
$url = Storage::disk('do_spaces')->url($path);

In the html

<img src="{{ $url }}" />


akLearn left a reply on Htaccess Problem

I did the redirection using the 'where' method. It worked


Route::get('/{pageSlug}', '[email protected]')->where('pageSlug','^([^\/\.]+).html$');

24 Jul
3 months ago

akLearn started a new conversation Htaccess Problem

Hi,

I have the following htaccess file


   RewriteEngine On 
   RewriteRule ^([^\/\.]+).html$ tapeDetailPage/

In the beginning it worked. It would pick up any url with .html extension and redirect to the given route. Now, it throws a page not found error. Here's a link to the screen shot ( https://prntscr.com/kamga2 )

Can anyone tell what i'm doing wrong?

14 Jul
4 months ago

akLearn left a reply on Is DigitalOcean's Bucket A Reliable Server?

I'm surprised no one else in the community used DigitalOcean's services.

akLearn started a new conversation Is DigitalOcean's Bucket A Reliable Server?

Hi everyone,

We've recently moved to DigitalOcean and are using their buckets to save non-structured data(mp3s). However, their bucket has been having problems for the past couple of days.

Can anyone share the experience they've had with DigitalOcean? Would appreciate anything you have to share? Should we move to Amazon?

11 Jul
4 months ago

akLearn left a reply on Eloquent Creates New Record Sometimes And Fails Sometimes

Ok... So, I found the problem. In case anyone else is having a similar problem....

There was another line of code which was failing. This was causing my API to crash silently. This was only happening in one scenario where partial information was given.

Long story short. It's not eloquent which is causing the crash. It's some other line of code you probably wrote.

@Dalma Thanks! I learned something new.

akLearn left a reply on Eloquent Creates New Record Sometimes And Fails Sometimes

Sure... The create call. I'm importing some data from an older site's DB. I don't which values are blank. So, I'm using the empty function check. Also, in the DB i've set the attributes to be nullable.


          // Save the values
             $newTape = Tape::create([
                  'id' => $request->id,
                  'name' => (!empty($request->tape_name)?"$request->tape_name":NULL),
                  'artist_id' => ($request->artist_id?$request->artist_id:null),
                  'artist_name' => (!empty($request->artist_name)?"$request->artist_name":null),
                  'tape_by' => ($request->artist_id?$request->artist_id:null),
                  'category' => ($request->category?$request->category:null),
                  'status' => 'active',
                  'views' => ($request->views?$request->views:null),
                  'downloads' => ($request->downloads?$request->downloads:null),
                  'keywords' => ($request->keywords?"$request->keywords":null),
                  'created_at' => (!empty($request->created_at)?"$request->created_at":null),
                  'tape_url' => (!empty($request->tape_url)?"$request->tape_url":null),
                  'cover_image' => $albumTapeCover
             ]);

The model


namespace App;

use Illuminate\Database\Eloquent\Model;

class Tape extends Model { protected $fillable = [ 'id','name', 'artist_id', 'artist_name', 'tape_by', 'category', 'status', 'views', 'downloads', 'keywords', 'tape_url', 'cover_image' ];

public $timestamps = true;

protected $dates = ['created_at','updated_at'];
public $incrementing = false;
/**
* Gets the user this tape belongs to
*/
public function user() {
     return $this->hasOne('App\User','id','artist_id');
}

/**
* Get the tracks that are on this tape
*/
public function tracks() {
     return $this->hasMany('App\Track','tape_id','id');
}

/**
* Get the category info
*/
public function categoryInfo() {
     return $this->hasOne('App\TapeCategory','id','category');
}

}

akLearn started a new conversation Eloquent Creates New Record Sometimes And Fails Sometimes

Hi,

I have a simple create query. It creates a new record at times and fails at times. Is there a way to get more information as to why it's failing. Is there a missing attribute, etc?

By the way, aside from the id of the table I set every attribute to not required (null-able)

04 Jul
4 months ago

akLearn left a reply on Storage::disk('something')->move($oldLocation, $newLocation) Fails But No Hints

I went to Digital Oceans web panel access of the bucket and tried to rename the file there. I was thinking that maybe there's a security issue that's preventing the file name change.

It accepted simple file name changes but didn't allow me to save names with special characters.

Yeah, that is weird. They should have a note that shows up on top of the web panel at least as a warning to users.

akLearn left a reply on Storage::disk('something')->move($oldLocation, $newLocation) Fails But No Hints

If anyone is following along, here's what happened. Digital Ocean has a rule where they don't allow you to save special characters in your filename. So, here's an example of what I was trying to save "03 - Cops And Rob [Prod By Zt].mp3".

This was the main reason the above code wasn't working. Hope this helps.

02 Jul
4 months ago

akLearn left a reply on Storage::disk('something')->move($oldLocation, $newLocation) Fails But No Hints

@Cronix $path = 'albums/17/178/mp3/someFile.mp3'; $newName = 'albums/17/178/mp3/newName.mp3';

akLearn left a reply on Storage::disk('something')->move($oldLocation, $newLocation) Fails But No Hints

Thanks for the help @Cronix I misunderstood

Both paths are the same. I printed them out to be sure. The only difference is in the name of the file on the $newName.

akLearn left a reply on Storage::disk('something')->move($oldLocation, $newLocation) Fails But No Hints

@Cronix So, there's one folder on the root called lets say "allMedia". All the paths are from one level up.

So, it's "allMedia/albums/etc"

The $path and $newName are starting from the "albums" onwards. However, I checked if my paths were correct by calling the exists method as shown in the initial post above.

akLearn started a new conversation Storage::disk('something')->move($oldLocation, $newLocation) Fails But No Hints

Hi everyone,

This is driving me nuts. I am using the below to rename a file on DigitalOcean's space bucket storage. Before running the command below, I make sure the file exists on the given path. However, the move method returns a false but no hints as to why the move (rename) is failing.

Please guide me on this.


// the condition below passes
if (Storage::disk('do_spaces')->exists($path)) {
           // this returns false
             Storage::disk('do_spaces')->move($path, $newName); 
}

akLearn left a reply on DigitalOcean Getting Uploaded Files

Thanks for the help guys

Here's what I was doing wrong. Admittedly, I am new to the whole bucket storage scene. I had not gotten the space key and space secret. I needed to set that in the .env and use it in the config/filesystems.php file.

For anyone else who's new, you need to go to the DigitalOcean/AW3 and get these things along with region and other info.

You can view a video tutorial on Youtube . However, this guy goes over the important info after half the video has passed by. https://www.youtube.com/watch?v=vFwy-vB_d_k

Hope this helps

01 Jul
4 months ago

akLearn started a new conversation DigitalOcean Getting Uploaded Files

Hi,

I'm new to uploading files to the clould. The MIS guy created a bucket and put a folder on the root. I have uploaded files to that folder but when I try to view those images via the img element, it doesn't show.

Route::get('/testing', function(){ return ''; });

26 Jun
4 months ago

akLearn left a reply on I Can Not Run Php Artisan Migrate

Try to run "php artisan " alone. If you get the same error, then there's probably a command (App\Console\Commands) which was created on this project and has an error in it.

You can do a site wide search using some of the keywords above and see if that helps.

akLearn started a new conversation [email protected] And Not [email protected]

Hi,

I've found answers for integrating [email protected] into Laravel 5.4 but nothing about 4.1.1. Which is what the front-end developer used to create the markup.

Does anyone know how to use Bootstrap 4.1.1 with Laravel 5.4? I've tried updating package json but hasn't helped.

25 Jun
4 months ago

akLearn left a reply on Search Multiple Tables For A Search Term

@rumm.an I selected your answer as the best answer. Please make the necessary adjustments to it because the "$input" or "$keyword" is not accessible within the query builder anonymous function.

akLearn left a reply on Search Multiple Tables For A Search Term

My mistake. It does work. I wasn't looping through all the records when I was doing QA on the query.


$keyword = 'jo'; $result = Tape::where('name','like','%'.$keyword.'%') ->orWhereHas('user', function($q) use ($keyword){ return $q->where('name','like','%'. $keyword . '%'); }) ->orWhereHas('tracks', function($q) use ($keyword){ return $q->where('name','like','%'. $keyword . '%'); })->get(); foreach($result as $res) { echo $res->name . ' ... Artist: ' . $res->user->name . ' ... '. '
'; foreach($res->tracks as $track) { echo '--------------track: ' . $track->name . '
'; } echo '

'; }

akLearn left a reply on Search Multiple Tables For A Search Term

@ rumm.an

It hasn't worked so far. I did have to change it a little seeing "$input" variable's scope wasn't accessible within the query builder anonymous function.

$result = Tape::where('name','like','%'.$keyword.'%') ->orWhereHas('user', function($q) use ($keyword){ return $q->where('name','like','%'. $keyword . '%'); }) ->orWhereHas('tracks', function($q) use ($keyword){ return $q->where('name','like','%'. $keyword . '%'); })->get(); echo $result[0]->name . ' ... Artist: ' . $result[0]->user->name . ' ... tracks: ' . $result[0]->tracks[0]->name; die();

akLearn started a new conversation Search Multiple Tables For A Search Term

Hi everyone,

I have searched and can't find the answer anywhere. I have three tables (user, tracks, album). I want to search for a single keyword in all three of these tables. So, if a user says "Jangy", I want to search this term as a possible artist name (user table), track name or an album name.

Here's what I tried but know will not work. App\Album::with(['user'=>function($q){ $q->where('name','like','%jo'); } ])->get();

I stopped here because it was returning albums but the users (artist) was blank for some albums. Meaning that the sub-query was not returning any users(artist) which didn't match the sub-condition, but it was returning all albums. I hope that made sense.

And yes, I did try to find the answer on my own but couldn't.

15 Jun
5 months ago

akLearn left a reply on Trying To Understand The Mentality

"When helping others you build up real life karma!" ... I liked this part.

Thanks

akLearn started a new conversation Trying To Understand The Mentality

Hi everyone,

Why do you guys go out of your way to help others asking the question?

I was going through some of the posts here, Stack overflow, etc. I couldn't understand the benefit of helping people with their development problems.

Why do you do it? What's the pay off? What am I missing?

I feel like asking the same question to people who create great plugins and then hand it out for free.