MThomas

Owner at Globe-View Solutions & Jonril

Experience

67,720

47 Best Reply Awards

  • Member Since 3 Years Ago
  • 470 Lessons Completed
  • 18 Favorites

16th June, 2016

MThomas left a reply on Deleted • 2 years ago

Why not share your question with us and add your solution? So others can learn form it :)

29th March, 2016

MThomas left a reply on It Shows An Error While I Am Using Make:seeder Command • 2 years ago

First, what laravel version are you using?

For the rest, check the documentation, normally php artisan make:seeder should work.

https://laravel.com/docs/5.2/seeding

MThomas left a reply on Migrate A New Table It Show The Following Error • 2 years ago

If you are in development and want to re-migrate the database run:`

php artisan migrate:refresh

MThomas left a reply on Apply Logic To All Controller Actions • 2 years ago

This is what Middleware is meant for, upon every request this is triggerd and there you can check what the users role is and redirect him/her.

https://laravel.com/docs/5.2/middleware

MThomas left a reply on Laravel 5 Redirect To Controller Action • 2 years ago

Yes, this is needed, otherwise there is no URI Laravel can redirect you to.

17th December, 2015

MThomas left a reply on HelpMe!!!! SOS • 2 years ago

And what does your config/app.php file look like?

MThomas left a reply on HelpMe!!!! SOS • 2 years ago

Did you?

It is explained fairly clearly here: https://laravelcollective.com/docs/5.1/html#installation

MThomas left a reply on HelpMe!!!! SOS • 2 years ago

Bro... sigh

Follow the steps described in the link I posted earlier.

MThomas left a reply on HelpMe!!!! SOS • 2 years ago

Did you registrate the package in config.php?

MThomas left a reply on HelpMe!!!! SOS • 2 years ago

Did you pull in the form package?

https://laravelcollective.com/docs/5.1/html

11th December, 2015

MThomas left a reply on Seeding Issue. Unintentional Automatic Column Added. • 2 years ago

@theamydance Now you set it up as a one to many relation, you need to use a Many To Many relation: http://laravel.com/docs/5.1/eloquent-relationships#many-to-many

10th December, 2015

MThomas left a reply on Problem Call Route Name (in Group) With Parameters • 2 years ago

I think that your htaccess is not correctly working. Are you using Laravel homestead or did you install everything locally?

MThomas left a reply on Non-default Queues With SQS – Wrong URLs Are Built • 2 years ago

@dusterio it seems there is no connection or provider method or property defined on a Job. I just did a check in the source, but did not had the time to dive in, but I do believe you need to figure out a way to override the Connector

MThomas left a reply on One To One Rerations • 2 years ago

@inyansuta Yeah in those cases you need to set them manually, to my knowledge there is no way of doing this with relations.

MThomas left a reply on One To One Rerations • 2 years ago

@inyansuta yes this is the better aproach (in the end, behind the scene the same thing happens).

It is good practice to mark the reply that answered your question as the 'answer', this helps others in finding their answers and users see that an answer has been formulated :)

MThomas left a reply on Non-default Queues With SQS – Wrong URLs Are Built • 2 years ago

@dusterio out the top of my head you can specify multiple connections/drivers in your config file, and invoke the connection/driver by specifying this like driver('sqs2') just like you can do this for your database connections.

MThomas left a reply on Any Way To Pass Arguments To A Job (Command) ? • 2 years ago

Not sure if this is what you are looking for but if you pass the arguments to the job you need to initialize the arguments in the Job constructor and then you can access them in the handle method

$this->dispatch(new SomeJob($user));

class SendReminderEmail extends Job
{

    protected $user;

    public function __construct(User $user)
    {
        $this->user = $user;
    }

    public function handle()
    {
        $this->user; //the passed user
    }
}

MThomas left a reply on One To One Rerations • 2 years ago

@inyansuta OK

I imagine that you have a Currency model?

In that case you could do something like this:

class Currency extends Model {

    public method user() {
        return $this->hasMany(User::class);
    }

}
$currency = Currency::find(1); // I assume you hardcode it since you do that in your opening post

$currency->user()->create($data);

MThomas left a reply on One To One Rerations • 2 years ago

If you take a look at the Laravel documentation (relationship section) you will find a paragraph dedicated to one-to-one relations:

http://laravel.com/docs/5.1/eloquent-relationships#one-to-one

MThomas left a reply on Dynamic Eloquent Relationships From DB • 2 years ago

I guess this is what you are looking for: https://github.com/jimbolino/laravel-model-builder/

But I highly recommend creating them yourself, this will force you to think about the names of the relations etc.

MThomas left a reply on I Have Issue When Use Elasticsearch • 2 years ago

@PhanPhy I think you need to be a bit more elaborate in what you are doing en where things go wrong. For example what index page does not load, a Elastic page or a laravel blade page etc.

MThomas left a reply on Dynamic Eloquent Relationships From DB • 2 years ago

@EfeEngin that is the place where you need to define a relationship. If you don't want to use Models for this (its what they are suposed to be used for) you need to work with database joins on the tables in your code.

MThomas left a reply on Can Someone Guide Me? • 2 years ago

@Zaki, please show us the whole method (and related methods, this is only the content of the array) and tell us what you want to accomplish.

And please put your code snippets in code blocks this will enhance readability :)

MThomas left a reply on Seeding Issue. Unintentional Automatic Column Added. • 2 years ago

In your Disease model you state that the disease belongs to a Field, this means that the disease table must have a reference in it to the field table (generated based on the table defined in your Field model).

I think that you need an hasMany relation, a disease has many fields, but I'm not sure if that is what you want.

For more on relations check: http://laravel.com/docs/5.1/eloquent-relationships#one-to-many &

MThomas left a reply on Dynamic Eloquent Relationships From DB • 2 years ago

Sorry, you need to be a bit more specific, I'm not sure what you want to do? What have you tried?

MThomas left a reply on Seeding Issue. Unintentional Automatic Column Added. • 2 years ago

Can you show us your migration file?

It seems there is no field_id column in your disease table.

MThomas left a reply on Can Someone Guide Me? • 2 years ago

@Zaki please show us the code that resulted in this error.

MThomas left a reply on .env DB_HOST Causes Problems (127.0.0.1 Vs Localhost) • 2 years ago

@Akeno than you need to get used to SSH into the VM, if you use laravel Elixir it is advisable to run that not on the VM but locally.

@bashy, yeah it has been a wile, started a new job last October and as a result I did not have any time left for some decent coding etc, now I'm starting to find some time to take a look at laracasts once in a while and to work on some of my personal hobby projects :) All well on your side?

9th December, 2015

MThomas left a reply on .env DB_HOST Causes Problems (127.0.0.1 Vs Localhost) • 2 years ago

@Akeno all commands that make contact with the DB (or any other things installed on the VM) need to be run in the VM. Otherwise you can add as @bashy states your homestead IP address.

MThomas left a reply on How To Remove The Default Foreign Keys In WithPivot()? • 2 years ago

@Desmond if you are building an API than it is all the more reason to take a look at Fractal, this will provide you with the functionality to hide the id's you want and to adapt any other things in the naming of attributes.

Phil Sturgeon wrote a book about API's, Laravel and Fractal.

THere is also an excalent serie on Laracast about API's.

MThomas left a reply on .env DB_HOST Causes Problems (127.0.0.1 Vs Localhost) • 2 years ago

Are you sure that you have ssh'd in the VM when you run the artisan commands?

The default DB_HOST 'localhost' should work for both.

MThomas left a reply on .env DB_HOST Causes Problems (127.0.0.1 Vs Localhost) • 2 years ago

What is your setup? Do you use Laravel Homestead or did you install PHP and the DB yourself?

MThomas left a reply on How To Remove The Default Foreign Keys In WithPivot()? • 2 years ago

I Think the issue is that @Desmond wants to 'hide' the values from the JSON output.

@Desmond, why do you want to hide these values? If you are building an API try implementing thephpleague/fractal. Otherwise try to explain why you need to hide the data.

7th December, 2015

MThomas left a reply on Laravel 5.0 Online Users Problem • 2 years ago

I think it is best that you update the sessions table by hooking into an event : http://laravel.com/docs/5.1/events#framework-events

Did you check that your method is even beeing called?

MThomas left a reply on SOCIALITE Provider Not Working • 2 years ago

Since your controllers are namespaced you need to use \Socialize or import it at the top like

use Socialize;

MThomas left a reply on Function That Checks Auth-Check • 2 years ago

@rene I'm not entirely sure, but that does not sound the same as a remembered me login. In config/auth.php is defined how long a login session lasts, if you come back within this time period no remember me login is triggered I think. I believe this will only happen outside of this period.

10th November, 2015

MThomas left a reply on Laracasts New Layout Is Awesome. • 2 years ago

@JeffreyWay The new layout looks great! One small thing, I noticed that the http://laracasts.com/all page has been removed, is there any chance we will add this later on?

16th September, 2015

MThomas left a reply on Authentication And Register Behaviour • 2 years ago

I'm not sure why foo and bar are not listed, however the remember token is hidden on the user model: https://github.com/laravel/laravel/blob/v4.2.11/app/models/User.php#L24

2nd June, 2015

MThomas left a reply on $article = New App\Article; • 3 years ago

maybe use new \App\Article?

18th May, 2015

MThomas left a reply on Multiple Queue Listeners • 3 years ago

@zuzex laravel does have some support for this, if you configure your listener correct than a job will be locked for some time.

The biggest problem with SQS is that it has the tendency to deliver message duplicates once in a while: https://www.google.nl/search?q=amazon%20sqs%20duplicate

So if you use SQS you will need to keep track of your pushed and pulled jobs :)

MThomas left a reply on Multiple Queue Listeners • 3 years ago

@zuzex for that you need to keep track of the jobs you are processing. If you push a job to the db, add a record to a table in the db, once your worker picks up the job the first thing you do is marking that job as currently in process in the table (a in_progress column?), once the job is finished you will mark the job as processed.

Each worker who picks op a job firsts checks if the job is not locked by an other worker.

MThomas left a reply on RESTful API • 3 years ago

Check out this post on the issues list on dingo/api: https://github.com/dingo/api/issues/398

You can start using it :)

MThomas left a reply on Multiple Queue Listeners • 3 years ago

@zurex yes that is possible too, just start multiple listeners that pick from the same queue.

queue:listen --queue=my_first_queue --timeout=7200
queue:listen --queue=my_first_queue --timeout=7200

Make sure you check that the queue timeout is set correctly, if it takes say 5 seconds to complete a job, you need to make sure that the queue job won't be released to an other worker too.

BTW best to make use of supervisor to keep your queues running: https://laracasts.com/lessons/supervise-this

MThomas left a reply on Which Laravel Admin Panel Should I Use? • 3 years ago

@sajib007 It is hard to say without diving into the code and functionality of the package if there will be conflicts.

MThomas left a reply on Which Laravel Admin Panel Should I Use? • 3 years ago

@sajib007 I don't think that there is an package that will fit your needs, and since this panel will be a core feature of your app it is best to write it yourself...

Instead of using mutliauth why not assign roles to the different types of users and based on the role you check if the user has access to a certain part of the site?

5th May, 2015

MThomas left a reply on Decrypting Password From DB • 3 years ago

@MichaelGrossklos the thing with auto generated passwords is, most of the time the user won't be able to remember them, so what will a frequent user of your app do once he receives an email with the password, he will print the password, write it on a sticky-note and keep it near his computer. (You might be lucky and the user saves the password in a password safe on his computer).

4th May, 2015

MThomas left a reply on Build First App • 3 years ago

@pmall totally, one we can add to the hall of fame :P

MThomas left a reply on Build First App • 3 years ago

@JeffreyWay, think you might want to check this thread out.

@pmall, he doesn't look like a subscriber, so yeah he's asking for an illegal copy.

16th April, 2015

MThomas left a reply on Where() On Collection Doesn't Work On Server • 3 years ago

Don't get me wrong, but an empty collection, any change your database is not seeded? (had a similar problem and it drove me nuts until I realized that database had no data in it).

MThomas left a reply on How Secure .env File, How Can Secure It • 3 years ago

@toniperic I think his problem is that he is not setting up his larvel install or vhosts correctly. I guess that his public folder is in his url ;)

Edit Your Profile
Update

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