mhdmirzaie

mhdmirzaie

Member Since 5 Months Ago

Kabul

Web Developer at Kabul

Experience Points 300
Experience Level 1

4,700 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 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

29 May
3 months ago

mhdmirzaie left a reply on Breadcrumb With Laravel API

@ROBOROBOK - Thanks for your reply, but most of them are not for Angular or Laravel API

mhdmirzaie started a new conversation Breadcrumb With Laravel API

Hi everyone,

I have created a recursive category for my document management system. I have created Model, Controller and it works properly. Now I want to add a Breadcrumb which shows address of current folder with its parents. I dont know how to make this dynamic Breadcrumb. my application has been created Laravel at backend and Angular in frontend. it would be appericiated if help me how to make the dynamic Breadcrumb.

Best,

Mir

// Model

class Category extends Model{

public function documents(){
    return $this->hasMany(Document::class);
}
public function children(){
    return $this->hasMany(Category::class, 'parent_id')->with('children');
}
public function parent(){
    return $this->belongsTo(Category::class, 'parent_id');
}

}

//Controller

public function index($category=0){

    $categories = Category::whereParentId($category)->with('documents', 'children')->paginate(24);
    return CategoryResource::collection($categories);
}
20 May
3 months ago

mhdmirzaie started a new conversation N-level Category (self Reference Relation)

Hi Everyone,

I want to create n-level nested category, I have defined category table and define relations as below, it works but return only root categories plus its first level children.

// Category Model

class Category extends Model { protected $table = 'dms_category';

protected $guarded = ['id', 'created_at', 'updated_at'];

public function documents(){
    return $this->hasMany(Document::class);
}

public function children(){
    return $this->hasMany(Category::class, 'parent_id');
}

public function parent(){
    return $this->belongsTo(Category::class, 'parent_id');
}

} //CategoryController

public function index() {

    $categories = Category::whereParentId(0)->with( 'children')->paginate();

    return CategoryResource::collection($categories);
}
19 May
3 months ago

mhdmirzaie started a new conversation How To Unwrap Json Data

Hi everyone,

I have created an api using resource file. the json data is wrapped into data object like below: I add below code in AppServiceProvider to unwrap the data but still it is wrapped.

Resource::withoutWrapping();

data is like below:

{ "data": [ { "id": 1, "name": "HR", "documents": [ { "id": 1, "title": "Attendace Sheet", "description": null, "doc_url": "", "category_id": 1, "user_id": 1, "created_at": null, "updated_at": null }, { "id": 2, "title": "Attendace Sheet", "description": null, "doc_url": "", "category_id": 1, "user_id": 1, "created_at": null, "updated_at": null } ], "created_at": null, "updated_at": null }, { "id": 2, "name": "Finance", "documents": [], "created_at": null, "updated_at": null }, { "id": 3, "name": "HR", "documents": [], "created_at": null, "updated_at": null }, { "id": 4, "name": "Finance", "documents": [], "created_at": null, "updated_at": null } ], "links": { "first": "http://localhost:8000/api/category?page=1", "last": "http://localhost:8000/api/category?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "path": "http://localhost:8000/api/category", "per_page": 15, "to": 4, "total": 4 } }

17 Apr
5 months ago

mhdmirzaie started a new conversation After Adding Auth Middleware To My Routes Error 404

Hi there,

I have added auth middleware to my routes, and now I see only 404 page. my routes are as below:

 Auth::routes();


Route::middleware('auth')->group(function(){
Route::get('/', '[email protected]')->name('home');

Route::get('reports','[email protected]')->name('reports');
Route::get('report/detail/{id}','[email protected]')->name('report.detail');
Route::get('report/create','[email protected]')->name('report.create');
Route::post('report/store','[email protected]')->name('report.store');
Route::get('report/edit/{id}','[email protected]')->name('report.edit');
Route::post('report/update/{id}','[email protected]')->name('report.update');
Route::get('report/delete/{id}','[email protected]')->name('report.delete');

Route::get('document/create','[email protected]')->name('document.create');
Route::post('document/store','Docume[email protected]')->name('document.store');
Route::get('document/detail/{id}','[email protected]')->name('document.detail');
Route::get('document/edit/{id}','[email protected]')->name('document.edit');
Route::post('report/update','[email protected]')->name('document.update');
Route::get('document/delete/{id}','[email protected]')->name('document.delete');

Route::get('/about-ofsd', '[email protected]')->name('about-ofsd');
Route::get('/about-project', '[email protected]')->name('about-project');
Route::get('/project-location', '[email protected]')->name('project-location');

});
14 Apr
5 months ago

mhdmirzaie left a reply on How To OrderBy And Paginate Posts With Its Comments List

@SHEZ1983 - Thanks and sorry for asking basic question, I am a really basic laraveler.

Mohammad.

mhdmirzaie left a reply on How To OrderBy And Paginate Posts With Its Comments List

@SNAPEY - Thanks for your reply, it solved my problem. can you please tell me how can I use paginate with this Eloquent query?

Thanks,

Mohammad

mhdmirzaie left a reply on How To OrderBy And Paginate Posts With Its Comments List

Hi, thanks for your reply, for now only posts. But it could be good if know how order the comments too.

mhdmirzaie started a new conversation How To OrderBy And Paginate Posts With Its Comments List

Hi everyone,

I have written below eloquent command to fetch all posts with its comments. I want to orderBy it and also paginate it. It would be appreciated if help me.

$posts = Post::with('comments')->get(); return view('index')->with('posts', $reports);

Thanks,

Mohammad from Afghanistan