mouzak

mouzak

Member Since 1 Month Ago

Experience Points 1,520
Experience Level 1

3,480 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 1
Lessons
Completed
Best Reply Awards 0
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.

15 May
4 days ago

mouzak left a reply on Trying To Get Property Of Non-object View Blade

resolved error thank's.

mouzak started a new conversation Trying To Get Property Of Non-object View Blade

Hi! how to solve this error please. controller $d=salaries::selectRaw('(salairebase + sursalaire) as total')->where('salaries.id', $request->id)->first()->total; $im=salaries::selectRaw('(nombreparts) as total')->where('salaries.id', $request->id)->first()->total; $import_query = DB::table('baremes')->where('revenubrut','=',$d); if( $im == 1){ $import_query->select('un'); }elseif ($im == 2){ $import_query->select('deux'); }elseif ($im == 1.5){ $import_query->select('uns'); }elseif ($im == 2.5){ $import_query->select('deuxs'); }elseif ($im == 3){ $import_query->select('trois'); }elseif ($im == 3.5){ $import_query->select('troisplus'); }elseif ($im == 4){ $import_query->select('quatres'); }elseif ($im == 4.5){ $import_query->select('quatresplus'); }elseif ($im == 5){ $import_query->select('cinq'); } $data['impot'] = $import_query->first();

        return view('bulletin_paie',compact("data"));

view @foreach( $data['impot'] as $i)

{{$i}}
@endforeach

when i do a var dd i get that

dd($data['impot']);

{#220 ▼ +"cinq": 7833 } the result is correct but I can not pass it to the view

14 May
5 days ago

mouzak left a reply on Incorrect Request

@GRENADECX - i have that {#219 ▼ +"un": 3567 }

mouzak left a reply on Incorrect Request

@GRENADECX - thank's very match.

in the view i do @foreach( $data['impot'] as $i)

456 Impôt sur le revenu
                    <td >{{$i}}</td>
                </tr>

@endforeach but i have a fault.

mouzak left a reply on Incorrect Request

@DEVFREY - ????????

mouzak left a reply on Incorrect Request

@VAN1310 - here is the code

public function B_paie( Request $request) { $data=array(); $data['bp'] = paie::create($request->all()); $data['bo'] = prime::create($request->all()); $data['parametres'] = parametres::all(); $data['paies' ]= DB::table('salaries') ->leftJoin( 'paies','salaries.id', '=', 'paies.salaries_id') ->leftJoin( 'primes','salaries.id', '=', 'primes.salaries_id') ->select('salaries.', 'paies.','primes.*') ->selectRaw('(IFNULL(congepaye, "0")+IFNULL(autreprimes, "0")+ salairebase + sursalaire + primetransport) as total') ->where('salaries.id', $request->id) //-> whereRaw('paie.mois >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)') ->get(); $data['date']=new \DateTime(); $data['som']=salaries::selectRaw('(salairebase + sursalaire) as total')->where('salaries.id', $request->id) ->get(); $d=salaries::selectRaw('(salairebase + sursalaire) as total') ->where('salaries.id', $request->id)->first() ->total; $data['tr']=DB::table('baremes')->where('revenubrut','=',$d)->select('trimf')->get(); $im=salaries::selectRaw('(nombreparts) as total')->where('salaries.id', $request->id)->first()->total; $data['impot']= DB::table('baremes') ->where('revenubrut','=',$d); if( $im == 1){ ->select('un'); } ->get();

return view('bulletin_paie',compact("data"));

}

mouzak left a reply on Incorrect Request

@DEVFREY - what is the syntax problem

mouzak left a reply on Incorrect Request

@VAN1310 - yet I use Illuminate \ Http \ Request; but it's not ok

mouzak started a new conversation Incorrect Request

please help me to correct this request

$im=salaries::selectRaw('(nombreparts) as total')->where('salaries.id', $request->id)->first()->total; $data['impot']= DB::table('baremes') ->where('revenubrut','=',$d); if( $im == 1){ ->select('un'); } ->get;

mouzak started a new conversation Table Reading

Hi! I have a problem to properly query my table which is in my database. I want to recover either column 1 or column 1.5 or column 2 etc. according to a variable. for example if $im=1 i recover the colum 1. if $im=2 i recover the colum 2 ....

$im=salaries::selectRaw('(nombreparts) as total')->where('salaries.id', $request->id)->first()->total; $d=salaries::selectRaw('(salairebase + sursalaire) as total')->where('salaries.id', $request->id)->first()->total; $data['impot']= DB::table('baremes') ->where('RB','=',$d) ->where(????) I do not know how to do this second condition

RB Trimf 1 1,5 2 2,5 3 3,5 4 4,5 50000 300 10 40 10 80 60 10 90 30 51000 300 40 30 20 50 90 20 50 60 52000 300 90 90 30 40 40 50 07 90 53000 300 70 70 70 70 30 90 80 20

03 May
2 weeks ago

mouzak left a reply on SQLSTATE[HY093]: Invalid Parameter Number: Mixed Named And Positional Parameters

@SNAPEY - can you help me fix the query?

    $d=salaries::selectRaw('(salairebase + sursalaire) as total ->where('salaries.id', $request->id)->first()->total;

  $im=salaries::selectRaw('(nombreparts) as  total')->where('salaries.id', $request->id)->first()->total;

    $data['impot']= DB::table('baremes')
       ->where(" ('revenubrut','=',$d){
           if($im='2.5') -> {select('deuxs')}
           or if($im =1') { ->select('un')}
           or if($im='1.5') { ->select('uns')}
            or if($im='2') { ->select('deux')}
           or if($im='3') { ->select('trois')}
           or  if($im='3.5') { ->select('troisplus')}


          }")->get();

mouzak left a reply on Request Error

@FTIERSCH - yes that's it and I do not want to check the column I want to check the value of the column

mouzak left a reply on SQLSTATE[HY093]: Invalid Parameter Number: Mixed Named And Positional Parameters

@SNAPEY - Please help me to correct this request. I have the error the column $im is not found while it is a variable. In addition, the query only executes the last select.

$d=salaries::selectRaw('(salairebase + sursalaire) as total' ->where('salaries.id', $request->id)->first()->total;

$im=salaries::selectRaw('(nombreparts) as  total')->where('salaries.id', $request->id)->first()->total;

$data['impot']= DB::table('baremes')
    ->where('revenubrut','=',$d)->where($im,'=',1) ->select('un')
  ->where('revenubrut','=',$d) -> where($im,'=', 1.5) ->select('uns')
    ->where('revenubrut','=',$d)->where($im,'=', 2) ->select('deux')
    ->where('revenubrut','=',$d)-> where($im,'=', 2.5) ->select('deuxs')
   ->where('revenubrut','=',$d) -> where($im,'=', 3) ->select('trois')
    ->where('revenubrut','=',$d)-> where($im,'=', 3.5) ->select('troisplus')
   ->where('revenubrut','=',$d) -> where($im,'=', 4) ->select('quatre')
   -> where('revenubrut','=',$d)-> where($im,'=', 4.5) ->select('quatresplus')
     -> where('revenubrut','=',$d) -> where($im,'=', 5) ->select('cinq')
   ->get();

mouzak started a new conversation Request Error

Please help me to correct this request. I have the error the column $im is not found while it is a variable. In addition, the query only executes the last select.

$d=salaries::selectRaw('(salairebase + sursalaire) as total' ->where('salaries.id', $request->id)->first()->total;

    $im=salaries::selectRaw('(nombreparts) as  total')->where('salaries.id', $request->id)->first()->total;

    $data['impot']= DB::table('baremes')
        ->where('revenubrut','=',$d)->where($im,'=',1) ->select('un')
      ->where('revenubrut','=',$d) -> where($im,'=', 1.5) ->select('uns')
        ->where('revenubrut','=',$d)->where($im,'=', 2) ->select('deux')
        ->where('revenubrut','=',$d)-> where($im,'=', 2.5) ->select('deuxs')
       ->where('revenubrut','=',$d) -> where($im,'=', 3) ->select('trois')
        ->where('revenubrut','=',$d)-> where($im,'=', 3.5) ->select('troisplus')
       ->where('revenubrut','=',$d) -> where($im,'=', 4) ->select('quatre')
       -> where('revenubrut','=',$d)-> where($im,'=', 4.5) ->select('quatresplus')
         -> where('revenubrut','=',$d) -> where($im,'=', 5) ->select('cinq')
       ->get();
02 May
2 weeks ago

mouzak left a reply on SQLSTATE[HY093]: Invalid Parameter Number: Mixed Named And Positional Parameters

@SNAPEY - hi! i do that but have this error Call to undefined method Illuminate\Database\Query\Builder::total()

mouzak left a reply on SQLSTATE[HY093]: Invalid Parameter Number: Mixed Named And Positional Parameters

@SNAPEY - it contain that : $data['som']=salaries::selectRaw('(salairebase + sursalaire) as total')->where('salaries.id', $request->id)->get();

30 Apr
2 weeks ago

mouzak left a reply on SQLSTATE[HY093]: Invalid Parameter Number: Mixed Named And Positional Parameters

this request

$d= $data['som'];

$data['impot']=DB::table('baremes')->where('revenubrut','=',$d)->select('trimf')->get();

29 Apr
2 weeks ago

mouzak started a new conversation Request

please help me to correct this query

$data['som']=salaries::selectRaw('(salairebase + sursalaire) as total')->where('salaries.id', $request->id); $data['impot']=DB::table('baremes') -> where($data['som'],'=',('baremes.revenubrut')) ->select('baremes.trimf')->get();

mouzak started a new conversation Database Query

Hi, I have a database with table1 and table2. I want to retrieve the value of table2 corresponding to table1. for example, if the user has entered 50000, I display 300

table1 table2 50000 300 51000 300 52000 300 53000 300 54000 300 55000 300

26 Apr
3 weeks ago

mouzak left a reply on (1/1) FatalErrorException Maximum Execution Time Of 60 Seconds Exceeded

Thank's!! I solved the error by adding ini_set('max_execution_time', 300); in the code.

25 Apr
3 weeks ago

mouzak started a new conversation (1/1) FatalErrorException Maximum Execution Time Of 60 Seconds Exceeded

hello, the execution of my query is very slow so I have this error (1/1) FatalErrorException Maximum execution time of 60 seconds exceeded. Please help me optimize it. Thank you.

controller public function importCSV(Request $request) {

           if($request->file('csv_file')) {
               $path = $request->file('csv_file')->getRealPath();
               $data = Excel::load($path, function ($reader) {
               })->get();

               if (!empty($data) && $data->count()) {
                   $data = $data->toArray();
                   for ($i = 0; $i < count($data); $i++) {
                       $dataImported[] = $data[$i];
                   }
               }
               bareme::insert($dataImported);

               return back();
           }
        else {
           return view('baremeIR');
       }


   }
24 Apr
3 weeks ago

mouzak left a reply on No Query Results For Model [App\salaries] Id

@FTIERSCH - so I have to remove $id = 5; ::findOrFail($id) in the controller. model class salaries extends Model{

public function relationPaie(){
    return $this->hasOne (paie::class);
}
public static function boot() {
    parent::boot();

    self::created(function ($model) {
        $model->relationPaie()->save(new paie());
    });

}

mouzak left a reply on No Query Results For Model [App\salaries] Id

@FTIERSCH - it's ok but I want the insertion is done each time there is a new entry in the table 'salaries'. I thought doing $ id = DB :: table ('salaries') -> id; :: findOrFail ($ id) but it does not work.

mouzak left a reply on No Query Results For Model [App\salaries] Id

@FTIERSCH - He's there class PaieController extends Controller {

public function B_paie( Request $request)
{
    $data=array();
    $data['sala'] = salaries::findOrFail('id') ->relationPaie()->save(new paie());
    $data['sal'] = salaries::all();
    $data['parametres'] = parametres::all();
    $data['paies' ]= DB::table('salaries')
            ->leftJoin( 'paie','salaries.id', '=', 'paie.salaries_id')
            ->leftJoin( 'primes','salaries.id', '=', 'primes.idsalaries')
            ->select('salaries.*', 'paie.*','primes.*')
            ->selectRaw('(IFNULL(congepaye, "0")+IFNULL(autreprimes, "0")+ salairebase + sursalaire + primetransport) as total')
            ->where('salaries.id', $request->id)
           //-> whereRaw('paie.mois >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)')
            ->get();
    $data['date']=new \DateTime();
    $data['som']=salaries::selectRaw('(salairebase + sursalaire) as total')
         ->where('salaries.id', $request->id)->get();

return view('bulletin_paie',compact("data"));

}

mouzak left a reply on No Query Results For Model [App\salaries] Id

@FTIERSCH - I want to save $ id table 'salaries' in table 'paies' as foreign key. the variable in the controller comes from the 'salaries' table. I tried to see if it will be registered in the 'paie' table and it is registered by cons if I replace it with $ id the error occurs

mouzak left a reply on No Query Results For Model [App\salaries] Id

@FTIERSCH - $id is primary key in table 'salaries' who have model 'salaries' relationPaie is a methode public function relationPaie(){ return $this->hasOne (paie::class); } I hope it's a little understandable

mouzak started a new conversation No Query Results For Model [App\salaries] Id

hi, how to resolve this error please? No query results for model [App\salaries] id controller $data['sala'] = salaries::findOrFail($id) ->relationPaie()->save(new paie()); when i do $data['sala'] = salaries::findOrFail('8') ->relationPaie()->save(new paie()); the request is executed but when i change the number by a variable i got an error.

mouzak left a reply on Missing Argument 2 For App\Http\Controllers\PaieController::B_paie()

@MKBAT - yet the $ id is good. if i do salaries::findOrFail('8') that pass but when i replace the id by the variable $id i have the error

23 Apr
3 weeks ago

mouzak left a reply on (1/1) BadMethodCallException Call To Undefined Method Illuminate\Database\Query\Builder::relationPaie()

I am always looking for a solution. I replace $data['sala'] = Salaries::firstOrFail($id) ->relationPaie()->save(new Paie($attributes)); by $data['sala'] = Salaries::find($id) ->relationPaie()->save(new Paie(array($attributes))); but I have this error Call to a member function relationPaie() on null

mouzak left a reply on (1/1) BadMethodCallException Call To Undefined Method Illuminate\Database\Query\Builder::relationPaie()

@SERGIU17 - public function B_paie( Request $request, $id) { $data=[]; $data['sala'] = Salaries::firstOrFail($id) ->relationPaie()->save(new Paie($attributes)); $data['sal'] = salaries::all(); $data['parametres'] = parametres::all(); $data['paies' ]= DB::table('salaries') ->leftJoin( 'paie','salaries.id', '=', 'paie.idsalaries') ->leftJoin( 'primes','salaries.id', '=', 'primes.idsalaries') ->select('salaries.', 'paie.','primes.*') ->selectRaw('(IFNULL(congepaye, "0")+IFNULL(autreprimes, "0")+ salairebase + sursalaire + primetransport) as total') ->where('salaries.id', $request->id) -> whereRaw('paie.mois >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)') ->get(); $data['date']=new \DateTime(); $data['som']=salaries::selectRaw('(salairebase + sursalaire) as total') ->where('salaries.id', $request->id)->get();

return view('bulletin_paie',compact("data"));

}

mouzak left a reply on (1/1) BadMethodCallException Call To Undefined Method Illuminate\Database\Query\Builder::relationPaie()

@SERGIU17 - that's it

public function B_paie( Request $request, $id) { $data=[]; $data['sala'] = Salaries::firstOrFail($id) ->relationPaie()->save(new Paie($attributes)); $data['sal'] = salaries::all(); $data['parametres'] = parametres::all(); $data['paies' ]= DB::table('salaries') ->leftJoin( 'paie','salaries.id', '=', 'paie.idsalaries') ->leftJoin( 'primes','salaries.id', '=', 'primes.idsalaries') ->select('salaries.', 'paie.','primes.*') ->selectRaw('(IFNULL(congepaye, "0")+IFNULL(autreprimes, "0")+ salairebase + sursalaire + primetransport) as total') ->where('salaries.id', $request->id) -> whereRaw('paie.mois >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)') ->get(); $data['date']=new \DateTime(); $data['som']=salaries::selectRaw('(salairebase + sursalaire) as total') ->where('salaries.id', $request->id)->get();

 return view('bulletin_paie',compact("data"));

}

mouzak left a reply on (1/1) BadMethodCallException Call To Undefined Method Illuminate\Database\Query\Builder::relationPaie()

@SERGIU17 - thank's i do that but i have this error

(1/1) ErrorException Argument 1 passed to Illuminate\Database\Grammar::columnize() must be of the type array, string given, called in C:\wamp64\www\gestion_RH\vendor\laravel\framework\src\Illuminate\Database\Query\Grammars\Grammar.php on line 131 and defined

mouzak started a new conversation (1/1) BadMethodCallException Call To Undefined Method Illuminate\Database\Query\Builder::relationPaie()

hi, please help me to resolve this error the method is defined in the model class salaries extends Model{public function relationPaie(){ return $this->hasOne ('App\paie') }} controller public function B_paie( Request $request, $id) { $data=array(); $data['sala'] = salaries::select($id) ->relationPaie()->save(new Paie($attributes)); }

mouzak left a reply on Missing Argument 2 For App\Http\Controllers\PaieController::B_paie()

@MKBAT - hi, i do it but i have that error (1/1) NotFoundHttpException in RouteCollection.php line 179

22 Apr
3 weeks ago

mouzak started a new conversation Missing Argument 2 For App\Http\Controllers\PaieController::B_paie()

Hi ! help me solve this error. thank you Route::get('/paie','[email protected]_paie')->name('paie'); controller

public function B_paie( Request $request, $id) { $data=array(); $data['sala'] = salaries::findOrFail($id); $data['sala']->relationPaie()->save(new Paie($attributes)); $data['sal'] = salaries::all(); $data['parametres'] = parametres::all(); $data['paies' ]= DB::table('salaries') ->leftJoin( 'paie','salaries.id', '=', 'paie.idsalaries') ->leftJoin( 'primes','salaries.id', '=', 'primes.idsalaries') ->select('salaries.', 'paie.','primes.*') ->selectRaw('(IFNULL(congepaye, "0")+IFNULL(autreprimes, "0")+ salairebase + sursalaire + primetransport) as total') ->where('salaries.id', $request->id) -> whereRaw('paie.mois >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)') ->get(); $data['date']=new \DateTime(); $data['som']=salaries::selectRaw('(salairebase + sursalaire) as total') ->where('salaries.id', $request->id)->get();

 return view('bulletin_paie',compact("data"));

}

model class salaries extends Model{

public function relationPaie(){
    return $this->hasOne ('App\paie');
}

}

19 Apr
1 month ago

mouzak left a reply on Foreign Key

@ASHRAAM - thank you but I have to write the code in 'paie' model or 'salarie' model?

18 Apr
1 month ago

mouzak left a reply on Foreign Key

@ASHRAAM - i want to retrieve salaries.id and save it in paie.idsalaries

mouzak left a reply on Foreign Key

@ASHRAAM - model paie class paie extends Model { public function relationsalaires() { return $this->belongsTo('App\salaries', 'idsalaries'); }

protected $table = 'paie';

}

mouzak left a reply on Foreign Key

public function relationPaie(){ return $this->hasOne ('App\paie'); } public function relationPrime(){ return $this->hasOne ('App\prime'); }

mouzak left a reply on Foreign Key

@ASHRAAM - salaries model

mouzak started a new conversation Foreign Key

hi,how to automatically retrieve the primary key from the table 'salaries'. knowing it's foreign key in the table'paie'. paie model

mouzak left a reply on Laravel Increment With Condition

@PUNKSOLID - your answer allowed me to move forward I register the command salaries: increment but there is no incrementation

mouzak left a reply on Laravel Increment With Condition

@PUNKSOLID - Thank you. I did it, but there is an incrementation each time the page is loaded. the foreach I made in the view for the value display can cause that?

17 Apr
1 month ago

mouzak left a reply on Laravel Increment With Condition

@PUNKSOLID - YES i have a table called salaries and that has a column called cumulconges. I would incremented that column in evry 30 days. Fank's.

mouzak started a new conversation Laravel Increment With Condition

Hi, I need help please I want to increment the colone 'cumulconges' of 2 days at each "end of the month ie in every 30 days. how to add this condition to this query

$data['cpt']=DB::table('salaries')->increment('cumulconges', 2); thank's

16 Apr
1 month ago

mouzak left a reply on Blade @if @else

@TYKUS - it's ok thank you very much