mouzak

mouzak

Member Since 5 Months 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-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.

15 May
4 months 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

14 May
4 months ago

mouzak left a reply on Incorrect Request

@GRENADECX - i have that Collection {#208 ▼ #items: array:1 [▼ 0 => {#219 ▶} ] } }

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

@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
4 months 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 I want that if the save value in the column equals 1 for example it returns the column 'un'

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
4 months 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
4 months ago

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

this queries

$d= $data['som'];

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

29 Apr
4 months ago

mouzak started a new conversation SQLSTATE[HY093]: Invalid Parameter Number: Mixed Named And Positional Parameters

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 400 52000 500 53000 600 54000 700 55000 800

26 Apr
4 months 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
4 months 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
4 months 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
4 months ago

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 - 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: No query results for model [App\salaries] id

22 Apr
4 months 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();

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

}

model class salaries extends Model{

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

}

19 Apr
4 months 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
4 months 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

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

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

namespace App;

use Illuminate\Database\Eloquent\Model;

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

protected $table = 'paie';

}

salaries model

namespace App;

use Illuminate\Database\Eloquent\Model; class salaries extends Model{

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

}

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. I made php artisan list to check if the command exists but 'salaries: increment' is not on the list but it is in console \ commands

17 Apr
4 months 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
4 months ago

mouzak left a reply on Blade @if @else

@TYKUS - it's ok thank you very much

mouzak left a reply on Blade @if @else

@TYKUS - how to compare the value and do the condition please

mouzak left a reply on Blade @if @else

@TYKUS - I compare the value {{$so->total}} to the value $pa->plafonIpresRC

mouzak started a new conversation Blade @if @else

hello i need help blade does not excute the @else condition. suggestions please

            @foreach( $data['parametres'] as $pa)
                @foreach( $data['som'] as $so)

@if($so>=$pa->plafonIpresRC) {{$pa->plafonIpresRC}} @else{{$so->total}} @endif

mouzak started a new conversation Laravel SelectRaw

hello i need help please, i add several columns. the result is good, but if one of the columns is null, the query does not return a result. How to solve this problem. Thank you.

public function B_paie( Request $request) { $data=array();

    $data['paies' ]= DB::table('salaries')
            ->leftJoin( 'paie','salaries.id', '=', 'paie.idsalaries')
            ->leftJoin( 'primes','salaries.id', '=', 'primes.idsalaries')
            ->select('salaries.*', 'paie.*','primes.*')
        ->selectRaw('(salairebase + sursalaire + primetransport + congepaye + autreprimes) as total')
            ->where('salaries.id', $request->id)
           return view('bulletin_paie',compact("data"));

}
15 Apr
5 months ago

mouzak left a reply on Laravel Sum

@NAKOV - thank you very much the mistake is resolved you really helped me

mouzak left a reply on Laravel Sum

@NAKOV - everything is fine thank you except I do not know how to add $data['som']=->total so that it returns the value only. thank you!!

public function B_paie( Request $request) { $data=array(); $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.*') ->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"));
}