tudosm

tudosm

Member Since 6 Months Ago

Experience Points
8,770
Total
Experience

1,230 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
77
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 2
8,770 XP
May
30
2 months ago
Activity icon

Replied to Mail Queue On The Deployed Server

unfortuantely godaddy doesn't allow me to install it ((

Activity icon

Started a new Conversation Mail Queue On The Deployed Server

hi all,

Would anyone be able to help me with the Laravel queueable mails. On the local server or deployment server i have alwys to run queue:work. How can I create a script or someting that would trigger this command.

Thank you very much!!!!

May
10
3 months ago
Activity icon

Awarded Best Reply on Resize Image Before Store

Solved it.

the public_path had to be removed.

Activity icon

Replied to Resize Image Before Store

Solved it.

the public_path had to be removed.

Activity icon

Started a new Conversation Resize Image Before Store

Hi all,

Need some help with resizing an image before storing it.

I have deployed my application on GoDaddy and I get an error when trying to access the updated image in order to resize it.

error: Image source not readable

<-- PHP

 if ($request->has('image')) {
        $imagePath = $request['image']->store('uploads', 'public');
        $image = Image::make(public_path("storage/{$imagePath}"))->fit(2200, 1000);
        $image->save();
    } else {
        $imagePath = 'uploads/banner.jpg';
    }

-->

I was thinking is something to do with the privacy of the folder store.

<-- PHP

    if ($request->has('image')) {

        $image = Image::make($data['image'])->fit(2200, 1000);

        $image->save();

        $imagePath = $image->store('uploads', 'public');

    } else {

        $imagePath = 'uploads/banner.jpg';

    }

-->

I am trying to resize uploaded image before storing but I get an error Command (Store) is not available for driver (Gd).

anyone encountered this issue before, thank you!

Apr
21
3 months ago
Activity icon

Started a new Conversation How Can I Have To Get Routs That Go To The Same Page

Hi All,

I have the following routes:

Route::get('/shop/{product}', '[email protected]')->name('shop.show');

Route::get('/shop/{category}', '[email protected]')->name('shop.category');

when I use them seems like the first one takes over. Is there something to do about that? thank you!

Mar
29
4 months ago
Activity icon

Started a new Conversation My App Doesn't Queue The Notifications After Git Clone On A Diffrent Machine

I use to develop on mac and when I cloned my app on windows seems like the mail notifications are not queued anymore. Anyone knows what could be the issue?

Mar
23
4 months ago
Activity icon

Replied to What Would Be The Best Approach To Track User's Activity And Show As Activity Or Timeline?

@deladels I mean activity that happens on my app for ex: user open a new account, user submitted new topic, user posted a comment, etc

Activity icon

Started a new Conversation What Would Be The Best Approach To Track User's Activity And Show As Activity Or Timeline?

I have currently set a table with activity tiles such as

  1. account opened
  2. new post created . . . etc

and another table table where I store user_activities

Therefore, when a new user creates a new account automatically in the store method after the user is created it will create an activity record of title "account opened" and store in user_activities.

Is it the best approach?

Activity icon

Replied to Gates Vs Policy

Better stick with gates and limit the resources access in the controllers! Thank you!

Activity icon

Started a new Conversation Gates Vs Policy

Hi Laracasts community! I have few Gates set and used though out the application.

When I registered a policy seems like the application doesn't pick up the rules set in the policy. Does it have to do something with the gates being used and somehow overwriting the rules or I am doing something wrong?

Thank you for your answer!

Activity icon

Awarded Best Reply on Delete Request Resulted In 404 Not Found

Sorted!

Basically the user is hidden therefore, by seeing an object of user it will fail as it is ignored.

Therefore, I have only send though the id of that user and further deleted in the controller.

Activity icon

Replied to Delete Request Resulted In 404 Not Found

With onlyTrashed I manage to show them on the view. Where I had a list of inactive or soft deleted users. In order to delete a user forever I build a new route and I was trying to send the User as object to the forceDelete method on UsersController.

Route::delete('{user}/forced', '[email protected]')->name('users.forced');

Activity icon

Replied to Delete Request Resulted In 404 Not Found

Sorted!

Basically the user is hidden therefore, by seeing an object of user it will fail as it is ignored.

Therefore, I have only send though the id of that user and further deleted in the controller.

Activity icon

Started a new Conversation Delete Request Resulted In 404 Not Found

Hi all,

I have a table that lists the users that are soft deleted. I am trying to figure out how to sent a request apart of get to delete the force delete the user. Any idea how to go around that ?

Thank you!

Mar
20
4 months ago
Activity icon

Replied to Send The User Back If An Error Thrown

Thank you! I will go through see if I can find something.

Mar
18
4 months ago
Activity icon

Started a new Conversation Send The User Back If An Error Thrown

Hi all,

Would anyone be able to help me with error handling process.

How can I send the user back or to a specific page if an error was thrown (any kind of error in controller).

Fo example sometimes I have students with degree level set sometimes not and instead of blowing up my app I want to safely sent the user back to home page. What would be the best case except checking if user has a degree level in controller ...etc

thank you very much !

Mar
17
4 months ago
Activity icon

Started a new Conversation Link Users With A Record From A Pivot Table (many-to-many)

Hi All,

I am trying to build an app where I have students that are studying a specific field (IT, Business, etc) that belongs to a particular degree level (BSc, MSc).

I have created the degrees table and the fields table than I created a pivot table degree_field.

Now, when I register users I need to assign them to a particular degree_field based on the selected field and degree.

I have built already the ajax request to return on the registering form the fields of a selected degree.

Where I store the use how do I create a relationship between users and degree_field.

Thank you for time taken too look over my question !!!

Activity icon

Replied to Ajax Request Denied Due To Error "with A Status Of 405 (Method Not Allowed)"

if I use get I get

"message": "No query results for model [App\User] {{ route('admin.userscontroller.fetch') }}",

Activity icon

Started a new Conversation Ajax Request Denied Due To Error "with A Status Of 405 (Method Not Allowed)"

Hi,

I am trying to fill a drop down select element with data returned after an ajax request triggered by onChange of another select element.

function

function fillDegreeFields() {

var degreeId = $("#degree").val();
var _token = $('input[name="_token"]').val();
var dependent = $('#degree').data('dependent');

alert(degreeId)

$.ajax({
    url:"{{ route('admin.userscontroller.fetch') }}",
    method:"POST",

    data:{degreeId:degreeId, _token:_token, dependent:dependent},

    success:function(result)
    {
        $('#'+dependent).html(result);
    }

})

}

route Route::namespace('Admin')->prefix('admin')->name('admin.')->middleware('can:manage-users')->group(function () {

Route::prefix('users')->group(function () {
    
    Route::post('import', '[email protected]')->name('users.import.store');
});

result Failed to load resource: the server responded with a status of 405 (Method Not Allowed)

anyone knows what could be the reason? Thank you!

Mar
06
5 months ago
Activity icon

Replied to Cannot Migrate Due To "Foreign Key Constraint Is Incorrectly Formed"

Found the answer, thank you all for help!

  1. Roll back all the migrations (or start with a fresh database);
  2. Change the dates that form the first part of the migration filenames so they're in the order you want (eg. for 2014_06_24_134109_update_database.php, the date & time is 2014-06-24, 13:41:09); Run the migrations again
Activity icon

Replied to Cannot Migrate Due To "Foreign Key Constraint Is Incorrectly Formed"

How do I order the migrations as all files are together in database>migrations folder

Activity icon

Replied to Cannot Migrate Due To "Foreign Key Constraint Is Incorrectly Formed"

I tried already, still doesn’t ((

Activity icon

Started a new Conversation Cannot Migrate Due To "Foreign Key Constraint Is Incorrectly Formed"

I have the following two tables

public function up() { Schema::dropIfExists('fields'); Schema::create('fields', function (Blueprint $table) { $table->bigIncrements('id'); $table->unsignedBigInteger('level_id'); $table->text('name'); $table->timestamps();

        $table->foreign('level_id')->references('id')->on('levels')->onDelete('cascade');
    });
}

public function up() { Schema::create('levels', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->timestamps(); }); }

and I get the following error General error: 1005 Can't create table smop.fields (errno: 150 "Foreign key constraint is incorrectly formed")") during migration. Please help!

Feb
23
5 months ago
Activity icon

Replied to Users That Have Role Of Supervisor And Teaches IT

I would love to speak with you in private, how can we sort it out?

Activity icon

Replied to Users That Have Role Of Supervisor And Teaches IT

seems like belongsToMany would work perfectly fine but not belongsTo or belongsToOne

Activity icon

Replied to Users That Have Role Of Supervisor And Teaches IT

'users.fields_id' shoudl actually be users.user_id

Activity icon

Replied to Users That Have Role Of Supervisor And Teaches IT

I got an error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.fields_id' in 'where clause' (SQL: select * from users where exists (select * from roles inner join role_user on roles.id = role_user.role_id where users.id = role_user.user_id and name = supervisor) and exists (select * from fields where users.fields_id = fields.id and name = IT))

Activity icon

Started a new Conversation Users That Have Role Of Supervisor And Teaches IT

I have 3 tables users, roles and fields.

The relations between users and fields are stored in pivot table field_user while the users and their roles are stored is role_user.

User class

public function roles() { return $this->belongsToMany(Role::class); }

public function fields()
{
    return $this->belongsToOne(Field::class);
}

Field class

public function users() { return $this->belongsToMany(User::class); }

Role class public function users() { return $this->belongsToMany(User::class); }

How to get all users that have role supervisors and belong to the IT field.

I managed to get all supervisors with

$supervisors = User::whereHas('roles', function ($query) use($role_name) {

    $query->where('name', $role_name);

    })->get();

but I cannot figure out how to filer only those with IT field

Activity icon

Replied to Add New Select Element According To The First Selected Option

I am using Laravel mix with Vue and Bootstrap I guess it comes with JS preinstalled. But, I am not an expert in JS. I believe there should be two select elements, one hidden.

As soon as the first select has got an option the second select element should pop up and also, query from DB the teachers

The first selector will display the fields,

The second one should be populated with users with the role of supervisor and field of the first choice

public function create() { $fields = Field::all();

    $role_name = 'supervisor'; // for example.

    $supervisors = User::whereHas('roles', function ($query) use($role_name) {

    $query->where('name', $role_name);

    })->get();

    return view('admin.users.create', compact(['supervisors', 'fields']));
}
Activity icon

Started a new Conversation Add New Select Element According To The First Selected Option

I have on select with study field options (IT, Bussiness, etc) on a registration form. I want the second select to contain only options of teachers of that specific field.

For example, if an admin is to register a new student on IT would it be possible to display the list only of teachers that teach that specific field by displaying a new select element populated with specific teachers.

Activity icon

Replied to User To User Relationship

thank you for this solution, helped me to move forward

Feb
12
5 months ago
Activity icon

Commented on A Project Can Have Tasks

Anyone able to explain why I get Call to a member function create() on null

public function addTask($body) { return $this->tasks()->create(['body'=>$body]); }

Activity icon

Commented on Prepping The Frontend

was trying to make to work for 2 days and the solution was so easy, thank you!