MWDeveloper

MWDeveloper

Member Since 2 Years Ago

Tangier

Web developer at Tangier

Experience Points 14,540
Experience Level 3

460 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 103
Lessons
Completed
Best Reply Awards 5
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.

22 Jun
2 years ago

MWDeveloper left a reply on Laravel Loads Footer File First

Hi @aurawindsurfing we use the signature @extends in order to extend the main blade or the master page of you application which contains head links and etc... While we you the signature @include in order to include or embed a portion or a blade page inside another one. So you actual page should be something like : ` @extends('your-master-page')

@include('header')

@include('footer') `

MWDeveloper left a reply on Hi Gays! Have A Migratoin Error

HI @anosh I think you will need to go to the database and look if the table is there then deleted, And try to follow the convention in the next time you fire the command line by naming the table in plural.

` php artisan make:migration create_articles_table --create=articles

`

09 Mar
2 years ago

MWDeveloper left a reply on Uploading Images And Storing In Database

@laradonk am happy to hear that brother.

01 Mar
2 years ago

MWDeveloper left a reply on Call To A Member Function Is() On Null

@martinbean Thanks alot, you saved my day keep it up bro.

24 Feb
2 years ago

MWDeveloper left a reply on Validating A Csv File

@laravel_newb make sure you have the enctype in your form tag

<form action="upload.php" method="post" enctype="multipart/form-data">

The if it did not work fine try the following method to see the extension of the uploaded file.

$filesource= $request->file('file');
          $fileExtension= $filesource->getClientOriginalExtension();
dd($fileExtension);
23 Feb
2 years ago

MWDeveloper left a reply on Validating A Csv File

@laravel_newb would you like please to show us the view page ?

MWDeveloper left a reply on Validating A Csv File

@laravel_newb use this to validate the input file


$this->validate($request, array(
      'file'   => 'max:10240|required|mimes:csv,xlsx',
    ));

MWDeveloper left a reply on Uploading Images And Storing In Database

@laradonk this should do the trick


public function store(Request $request)
    {
      $this->validate($request, array(
        'name' => 'required',
        'image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
      ));
      //save the data to the database
        $person  = new person ;
        $person->name = $request->name;

        if($request->hasFile('image')){
          $image = $request->file('image');
          $filename = time() . '.' . $image->getClientOriginalExtension();
          Image::make($image)->resize(300, 300)->save( storage_path('/uploads/' . $filename ) );
          $person->image = $filename;
          $person->save();
        };

      $person->save();

      return redirect()->route('people.index')
        ->with('success','Item created successfully');
    }


make sure to use this in the top of your controller


use App\Person;
use Image;

the file will be moved inside the storage folder under the uploads folder .

i the field image of the form

<div class="form-group">
    {!! form::file('avatar',['class'=>'form-control','placeholder'=>''])!!}
</div>

hope that helps now

22 Feb
2 years ago

MWDeveloper left a reply on Uploading Images And Storing In Database

@laradonk try this


public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required',
            'image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
        ]);

person = new person;
person->name = $request->name;

if($request->hasFile('image')){
          $image= $request->file('image');
          $filename = time() . '.' . $image->getClientOriginalExtension();
          Image::make($image)->resize(300, 300)->save( public_path('/images/' . $filename ) );
          //$user = Auth::user();
          $person ->image= $filename;
          $person ->save();
        };
          $person ->save();

return redirect()->route('people.index')
        ->with('success','Item created successfully');
}


MWDeveloper left a reply on Laracast 5.4 Laravel From Scratch #19 Password Not Being Stored Encrypted, Auth Not Working

@joyhanawa


public function store(Request $request)
    {
      $this->validate($request, array(
        'name' => 'required',
        'email' => 'required|email',
        'password' => 'required|confirmed'
      ));

      //save the data to the database

        $user = new user;
        $user->name = $request->name;
        $user->email = $request->email;
        $user->password = bcrypt($request->password);

        $user->save();

      return redirect()->route('/');
    }



MWDeveloper left a reply on Migrations

@anmol try to delete them manually one by one from the database and then rerun the command php artisan migrate or php artisan migrate:refresh

21 Feb
2 years ago

MWDeveloper left a reply on [PhpUnit] Maximum Function Nesting Level Of 100

try to use the compact method

public function index(){ $jeux = Produit::all(); return view('jeux.index',compact('jeux')); }

MWDeveloper left a reply on Project Management / What To Build / Where To Start

@zachleigh thanks for the approach. it is very important to do this in order to deliver a good tested application. but in my case i try to illustrate the application design using class diagram and data flow diagram. do that at any time you will be able to get the generate idea of which methods you will need to work with and to have a deeper understanding of the architecture of the application so that you can imagine the flow just before you start coding. while the units test are the last thinks a do before the project documentation and delivery.

15 Feb
2 years ago

MWDeveloper left a reply on Error " Call Undefinded Builder::save()" When I Save Record With Relationships

how can i make it to get link_code not link_id??? link->link_code

MWDeveloper left a reply on Error " Call Undefinded Builder::save()" When I Save Record With Relationships

rename this

public function click() { return $this->hasMany('App\Click'); }

to

public function clicks() { return $this->hasMany('App\Click'); }

plural because the relation is one to many

MWDeveloper left a reply on Querying Relationship

happy to help brother @rojonunoo

MWDeveloper left a reply on Hashing Users Passwords From Csv

Find the solution here

http://stackoverflow.com/questions/38025426/how-to-make-hash-password-if-import-excel-laravel-5-1

using the method

public function setPasswordAttribute($value){

$this->attributes['password'] = Hash::make($value);

}

MWDeveloper left a reply on Querying Relationship

public function student()

{

return $this->belongsTo('App/Student'); }

in your fees module you should have the method student in a singular form not plural use student() instead of students()then do the following

$fees->student->name;

MWDeveloper left a reply on Querying Relationship

@rojonunoo check your database you might have a record empty!!

MWDeveloper left a reply on Querying Relationship

$fees->students->name;

MWDeveloper started a new conversation Hashing Users Passwords From Csv

hi all Is there a way to hash passwords imported from csv file that contains users and their passwords and emails

here is the code using Excel facade

Excel::load(Input::file('users'),function($reader){ $reader->each(function($sheet){ User::firstOrCreate($sheet->toArray(

    ));
  });
});
13 Feb
2 years ago

MWDeveloper left a reply on This Action Is Unauthorized - Authorization Policy

@kaaps please try to use this return

$user->id == $carros->id_user;

instead of

return $user->id === $carros->id_user;

12 Feb
2 years ago

MWDeveloper left a reply on Errors Occurred When Using 'php Artisan Migrate'

@etrainerspy please try to delete your database table manually from sequel_pro and run php artisan migrate one more time

MWDeveloper left a reply on Headache With Middleware

Thank you very much @jlrdw for your help I do appreciate that.I had no idea about gates so I went to look for it and I learned about policy which was the best solution to my problem.thanks bro

MWDeveloper left a reply on Headache With Middleware

@jlrddw would you like please to give me an example of gate?

MWDeveloper left a reply on Headache With Middleware

Thanks @jlrdw for the reply but this is not my case i think my case is linked to middleware. especially in resource controllers

MWDeveloper started a new conversation Headache With Middleware

I need help. I have two roles for user employee and admin and I have a resource controller. Is there any way to do the following in my controller constructor ?

  • admin is allowed to access all methods while the employee is not allowed to access the index method

I don't know if there is a problem with my code ?

$this->middleware('employee', ['except' => ['index']]); $this->middleware('admin');

but this prevent users to access the index method.

please help

MWDeveloper started a new conversation Laravel Middleware Constructor

hi when i run one middleware inside a constructor the result is good but when i make two different middlewares inside on controller it doesn't work one of them and sometimes both. !!

10 Feb
2 years ago

MWDeveloper left a reply on DomPDF Download()

Thanks @swalker2 for the reply. I revised the route file but there is no problem from this kind !! .here is my code to make it clear to understand what's happening

$pdf = PDF::loadView('pdfs.result', [ 'user'=>$user ])->save(public_path('/pdfs/'.'_'.$user->id.'.pdf' )); return $pdf->stream();

return a downloadable link looks like this ''http://localhost:8000/users" and when i download it it generate the same pdf with incremented ids in their file names. something like 144.pdf ,145.pdf and 146.pdf

MWDeveloper started a new conversation DomPDF Download()

Hi everybody I save a pdf to public path and when i want to download it or stream it, It generates other pdfs and fails to download the one I call Any idea ?

09 Feb
2 years ago

MWDeveloper left a reply on Stream Method Of Laravel DomPdf Is Downloading The Pdf Instead Of Showing The Preview

public function getResult(){ $pdf = PDF::loadView('pdfs.result'); return $pdf->stream('result.pdf'); }

MWDeveloper started a new conversation Stream Method Of Laravel DomPdf Is Downloading The Pdf Instead Of Showing The Preview

hi guys i need to style the pdf in order to get the desired shape. So I used the method strem() which I used to work with in my previous projects. but now It is not working properly and it push the file to download instead of open it in a new tab. I tried some solutions on the web but still at the same point. Thanks in advance.

08 Feb
2 years ago

MWDeveloper left a reply on Laravel 5 - Dompdf Doesn't Work - Any Fix There?

I have the same problem but \PDF did not solve the problem . any one can help ?

31 Jan
2 years ago

MWDeveloper left a reply on Change The Pagination Links' Color

the solution of this is :

/* bootstrap links colors*/ .pagination > li > a, .pagination > li > span { color: green; // use your own color here }

.pagination > .active > a, .pagination > .active > a:focus, .pagination > .active > a:hover, .pagination > .active > span, .pagination > .active > span:focus, .pagination > .active > span:hover { background-color: green; border-color: green; }

found it in here: http://stackoverflow.com/questions/28864718/how-to-change-the-color-of-the-stock-pagination-that-come-with-laravel

MWDeveloper left a reply on Change The Pagination Links' Color

@w1n78 thanks for the response but the question is where to place these lines, I mean in which file ? I did create a new file in the desired path and I name it pagination.less and I have copied those lines to the style page but no change.

MWDeveloper left a reply on Mix, Compress And Cache Js/css Files

@kossa follow the following steps, they may solve the problem ;

1--> Try to get the last version of nodejs from here "https://nodejs.org/en/download/" so you will profit from the last version of npm. 2--> Run "npm install" 3--> Embed the app.css link and the script app.js into your blade page 4--> Instead of the command "gulp" run the command "npm run watch" or "npm run dev" or "npm run hot" or "npm run production".

MWDeveloper started a new conversation Change The Pagination Links' Color

Hi devs I want to change the color of post index's links. So i tried to inspect the element of the links in my index blade page and i did it on the browser and when I want to copy the page content of "pagination.less" I did not find it within the path "assets/css/less/pagination.less" any idea ?

MWDeveloper left a reply on Migration Error

I understand from this that you created the table and you deleted the migration from the editor . if this is the case you should delete the post table from the database before you run the command php artisan migrate.

MWDeveloper left a reply on Do I Really Need Server Side Validation?

@ralanyo In my opinion server side validation is very important since there are many types of users and it is the best way to keep your data safe and laravel make it easier.

30 Jan
2 years ago

MWDeveloper left a reply on Send Sms Free From Laravel Application

@martinbean I do really know that "Twilio" and other services are very good choices for some countries . Unfortunately the networks providers make it a bit expensive. anyway thanks guys.

MWDeveloper left a reply on Send Sms Free From Laravel Application

@Ftoi am very glad to receive a reply from you. please can you tell me all that cost ?

29 Jan
2 years ago

MWDeveloper left a reply on Send Sms Free From Laravel Application

@webdevb I went to the main website but i found that it is not free ? I would like to point out one more thing about my question is that the networks covered in my country have an expensive pricing service comparably to the other countries in the word so that the client would not be satisfied at the end of the story !!

MWDeveloper started a new conversation Send Sms Free From Laravel Application

Hi Devs I would like to ask you if there is any way to send sms from my laravel application without using a paid service as twilio or .... ?

21 Jan
2 years ago

MWDeveloper left a reply on Why Does Put Http Request Need Csrf Token, Patch Request Not?

The difference is : patch is used when we want to change one or some fields while put is used to update the whole instance of the object which including the id

=> thats why csrf token fade up.

hope that make sense

MWDeveloper left a reply on User Role Issue

@mulhaq $role_employer contains a Role object and you want to attach a role attribute to the $employer . I thing you should do this

return $employer->role->attach($role_employer->name);

MWDeveloper left a reply on User Role Issue

make sure you're preventing pass assignment via putting the following method with the model appropriate fields inside

protected $fillable = ['role'];

MWDeveloper left a reply on Pagination Custom Page Urls

according to the style of the URL it could not be fixed while if you want to check if the page is out of pages range you have to take a look to this:

https://laravel.com/docs/5.3/pagination#converting-results-to-json

in your case you should convert the result to json and then use the property "last_page" and check.

MWDeveloper left a reply on Undefined Variable User: View

have you tried this ?

url('/adminpanel/user/'.$model->id)