Sithira

Sithira

Member Since 3 Years Ago

Experience Points 8,340
Experience Level 2

1,660 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 66
Lessons
Completed
Best Reply Awards 1
Best Reply
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.

18 Aug
1 year ago

Sithira left a reply on Laravel Valet Memory Limit Change?

i know this is a OLD question but her is the answer. in /usr/local/etc/php/7.0/conf.d there is an additional .INI by name php-memory-limits. there you will find the limitations.

12 Jul
1 year ago

Sithira left a reply on Foo/{foo_id}/bar/create

You mean routes or relationships ?

30 Dec
2 years ago

Sithira left a reply on User Object Returns Empty When Trying To Set Class Properties In Constructor

used getAttribute method on the User Model

Sithira started a new conversation User Object Returns Empty When Trying To Set Class Properties In Constructor

class User extends Authenticatable {

public $tracksSystemDir;

public $contentSystemDir;

public function __construct(array $attributes = []) { parent::__construct($attributes);

    // setup system directory paths
    $this->tracksSystemDir = public_path() . '/storage/users/' . $this->reference . '/tracks/';
    $this->contentSystemDir = public_path() . '/storage/users/' . $this->reference . '/content/';

}

// when i try to user $this->tracksSystemDir it returns empty, in fact User object returns empty

}

04 Feb
3 years ago

Sithira left a reply on CURL Error 77 On Windows 10 XAMPP

@rodiniaweb ... i ended up using homestead . However issues is coming from windows itself . Anyway thanks for replying :)

25 Jan
3 years ago
24 Jan
3 years ago

Sithira started a new conversation CURL Error 77 On Windows 10 XAMPP

im trying to upload a text file to my S3 bucket. Every time i try i get this error

RequestException in CurlFactory.php line 187:
cURL error 77: error setting certificate verify locations:
CAfile: ‪pathToMy.pem 
CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

i have my .ini set up like this

curl.cainfo=‪"D:\LocalHost\php\ext\cacert.pem"

And finally in my controller i have something like this

        $S3 = \Storage::disk('s3');
        $S3->put('test.txt', 'First file upload', 'public');

any help would be greatly appreciated :)

02 Jan
3 years ago

Sithira started a new conversation Dd(Request) Returns Empty

im using laravel 5.2 . in the controller when i do

    public function submitEvent(Request $request)
    {
        dd($request);
    }

it returns this ( no param are displayed )

Request {#183}

but when i try Request::all() it works as expected . Any idea why ?

26 Dec
3 years ago

Sithira left a reply on Auth::user() Return Null On Laravel 5.2

Found it ! . in Laravel 5.2 Auth::user() works only if middleware 'web' is attached to it ( Route ) . Anyone know how to make it global ?

Sithira left a reply on Auth::user() Return Null On Laravel 5.2

just dd(Auth::user()) and it returns null . it worked with 5.1. but not in 5.2 PhpStorm also hinted me that user method does not exists in the Auth Class .

Sithira started a new conversation Auth::user() Return Null On Laravel 5.2

Topic says it all .. Tried Multiple times . Did Several Installations. any idea why ?

25 Dec
3 years ago

Sithira left a reply on Eloquent Subquery With Aggregate

Yep used DB .. Thanks guys :)

Sithira started a new conversation Eloquent Subquery With Aggregate

How do i perform this kind of a query using Eloquent

SELECT * FROM `tracks` WHERE listens = (SELECT MAX(listens) FROM tracks WHERE user_id = 1) and user_id = 1
23 Dec
3 years ago

Sithira left a reply on Constrain Does Not Take Effect When Eager Loading

Thanks you very much @veve286 ... it should be like this. it was a typo with(['tracks.subgenres' => function($query)])

22 Dec
3 years ago

Sithira left a reply on How Do I Define This Type Of Relationship ?

@pmall are you suggesting me to add column to the Track table to contain the TrackType ID ?

Sithira left a reply on How Do I Define This Type Of Relationship ?

yes. i understood what you suggested . i tried several times but no luck . if you have time and if you can , kindly show me the code ? im really out of options now :/

Sithira left a reply on Constrain Does Not Take Effect When Eager Loading

@veve286 thanks . i tried that . but no luck . As i said constrain with closure does not take effect at all .

This is my Stable Structure . https://laracasts.com/discuss/channels/eloquent/how-do-define-this-type-of-relationship

Sithira started a new conversation Constrain Does Not Take Effect When Eager Loading

i have this function to get the results from joining relationships. but how ever constrains seems not taking effect . if i comment out the constrain still it gives the same results set where as uncommented constrain

public function singleCategory($type, $category)
 {
        $track = TrackType::with(['tracks.subgenres'], function($query, $category) {
            $query->where('name','=', $category);
        })->where('name', '=', $type)->get();

        dd($track->toArray());
 }

Any help would be really appreciated :)

Sithira left a reply on How Do I Define This Type Of Relationship ?

Yes . Your are Correct @pmall . What do you suggest ?

Sithira left a reply on How Do I Define This Type Of Relationship ?

@kenmoini .. It worked =D .. Thanks man . I mean for all the support (Y)

All i did was this ( Changed the RelationShip to this .. i changed it to hasMany before )

    /**
     * Gets the tracks lists Accociated with a track type
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function tracks()
    {
        return $this->belongsToMany('App\Tracks', 'track_tracktype', 'tracktype_id', 'track_id');
    }

and the Query was this

    $track = App\TrackType::with(['tracks.subgenres'], function($query) {
        $query->where('name', 'Trans');
    })->where('name', 'Mashup')->get();

Sithira left a reply on How Do I Define This Type Of Relationship ?

Subgeneres table

        Schema::create('subgenres', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('genre_id')->unsigned();
            $table->foreign('genre_id')->references('id')->on('genres')->onDelete('cascade');
            $table->string('name');
        });

Subgenere and tracks (Pivot)

        Schema::create('subgenre_track', function (Blueprint $table) {
            $table->integer('subgenre_id')->unsigned()->index();
            $table->foreign('subgenre_id')->references('id')->on('subgenres')->onDelete('cascade');
            $table->integer('track_id')->unsigned()->index();
            $table->foreign('track_id')->references('id')->on('tracks')->onDelete('cascade');
            $table->primary(['subgenre_id', 'track_id']);
        });

TrackType table

        Schema::create('tracktype', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
        });

TrackType and Tracks table (Pivot)

        Schema::create('track_tracktype', function (Blueprint $table) {
            $table->integer('track_id')->unsigned()->index();
            $table->foreign('track_id')->references('id')->on('tracks')->onDelete('cascade');

            $table->integer('tracktype_id')->unsigned()->index();
            $table->foreign('tracktype_id')->references('id')->on('tracktype')->onDelete('cascade');

            $table->primary(['track_id', 'tracktype_id']);
        });

Just wanted to give you a quick idea what my structure looks like

Sithira left a reply on How Do I Define This Type Of Relationship ?

it grabs all the records on the Tracks table without respecting the where clauses . i might have to change my tables right ?

Sithira left a reply on How Do I Define This Type Of Relationship ?

There are 2 assigned for the Trans. And what i noticed is that i have tracks starting with ID 3 and goes on ( removed first 2 ) . But here the 2nd Query tries to get the Track associated with the ID 1 which is not correct . is there anything wrong with the Query ? im out of options now :/

21 Dec
3 years ago

Sithira left a reply on How Do I Define This Type Of Relationship ?

Thanks @kenmoini your suggestion worked for but there are some small issues with it .

i tried this ( Eager Loading )

App\TrackType::with(['tracks.subgeneres' => function ($query) {
        $query->where('name', 'Trans');
    }])->where('name', 'Single')->get();

then i dumped the Query . this is what i got

array:2 [▼
  0 => array:3 [▼
    "query" => "select * from `tracktype` where `name` = ?"
    "bindings" => array:1 [▼
      0 => "Single"
    ]
    "time" => 0.51
  ]
  1 => array:3 [▼
    "query" => "select * from `tracks` where `tracks`.`id` in (?)"
    "bindings" => array:1 [▼
      0 => 1
    ]
    "time" => 0.48
  ]
]

That second Query is totally unnecessary for me . instead i want to get the tracks with the tracks that have TrackType of Single and Subgeneres with Trans . how do i get rid of that second query and filter through all my tracks which only contains a specific subgenre ID ?

By the way nice Explanation . Appreciate it alot :)

Sithira started a new conversation How Do Define This Type Of Relationship ?

i have 3 models Tracktype, Tracks and Subgenres . The relationship is like this . A Tracktype has many tracks and a track can have many subgenres . but a track can only have one track type

i have already defined relationships like these

/**
 * Gets the tracks lists Associated with a Tracktype ID
 *
 * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
 */
public function tracks()
{
    return $this->belongsToMany('App\Tracks', 'track_tracktype', 'tracktype_id', 'track_id');
}

and on the Subgenres model

/**
 * Get the Lists of tracks Associated with the Subgenre ID
 *
 * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
 */
public function tracks()
{
    return $this->belongsToMany('App\Tracks', 'subgenre_track', 'subgenre_id', 'track_id');
}

i have used pivot tables also . by the way my requirement is get all tracks associated with the track type and subgenre name .

Right now can i get all the Tracks associated with the Tracktype . the part i cant understand is that where to define the subgenre name so that i can get only the Tracks associated with the track type and subgenre name .

My Routes Looks like this

Route::get('/category', 'pagesController@mainCategories'); Route::get('/category/{type}', 'pagesController@mainTypes'); Route::get('/category/{type}/{category}', 'pagesController@singleCategory');

i have gone through docs many times and did some googling . But no luck . if some one can tell me what to do and explain me little bit , i would really appreciate that :) and as you might noticed already im pretty new to laravel :3

19 Dec
3 years ago

Sithira left a reply on Issue With File::makeDirectory() On Ubuntu

Yeah i did .. its all good jhoff ... Thank you again :)

Sithira left a reply on Issue With File::makeDirectory() On Ubuntu

its weird .. when i tried that it didn't work .but i copied and pasted you code . Boom it worked :3 .. But there was issue i cant delete the created file . but chmod did the trick ... by the way thanks jhoff

Sithira started a new conversation Issue With File::makeDirectory() On Ubuntu

Today i used Amazon EC2 Service to Host my laravel application on ubuntu 14 . Every thing works fine except making nested directories .

As a example i want to create a folder inside public folder , inside that folder i need to create a folder called example and inside that folder i need create a folder called EC2 . So Basically its looks like this public/example/EC2 .

But when the Script runs its creates the folder with the name public/example/EC2 .Directories are not nested .

Does anyone know whats wrong with this ? and by the way i used public_path() to get the path of the public folder ( i need to create subfolders inside public folder )

10 Dec
3 years ago

Sithira left a reply on Use GetID3 In Laravel 5

fixed issue by adding updating the composer with this "autoload-dev": { "classmap": [ "tests/TestCase.php", "vendor/james-heinrich/getid3/getid3/write.php" ] },

Sithira left a reply on Use GetID3 In Laravel 5

yes i have the same issue writetags class .. Laravel says its Not found ? Guys any help ?

Sithira left a reply on Trying To Read/write Mp3 File Tags

i get the same error too .. above solution does not works ... Can someone please help ? :/