saluei

saluei

Member Since 1 Month Ago

Experience Points
1,450
Total
Experience

3,550 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
4
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 1
1,450 XP
Sep
23
4 days ago
Activity icon

Replied to Inser Whereraw To Where Input Condition Array

thank's a4ashraf

i want to create whereraw clause without query , and reuse the clause anywhere, so create array of clause. but in array can not put whereraw, how I can insert (put) whereraw in the array clause passed to where function ?

Activity icon

Started a new Conversation Inser Whereraw To Where Input Condition Array

hi how I could create query condition dynamically with raw where, I want something like whereraw that join together:

var  $QueryCondition=[];
 if($Flag1)//something is true
 {
       array_push($QueryCondition,  ['filde1' , 'like' , '%'.$value.'%']   );
 }
if(function_test(..) )//some function return true
{
      //how to insert raw where to condition
      array_push( $QueryCondition, whereraw('......')  );//this dose not work ??????
}
if($param1=='test')
{
      array_push($QueryCondition,  [$filde_name , '=' , $user_value]   );
}

$result= MyModel::select(['a', 'b', 'c', 'd'])->where($QueryCondition);

Sep
17
1 week ago
Activity icon

Replied to Get List Of All Old Value In *.blade.php

sel_box_name is variable , but its JavaScript variable at client side

it is in javascript loop and is the name of select box in each loop,

if I have list of all old value my problem solved, thank's

Activity icon

Replied to Get List Of All Old Value In *.blade.php

thank's jlrdw I have java script function that get the list of all select box on the form with options of each select box and fill all select box , in addition that function get the model object from controller (*.php) to select proper option in each select box, problem is when user change the one select box options to something else if validation failed , keep selected option on the form (keep old value), thing is that I write just one function to use in all form , so I want to retrieve the list of all old selected option

$(document).ready(function () {
        var selboxinfo ={!! $SelBoxInfo !!};//key value array [select box name=>[array of option] ]
        var UpdateEntObj ={!! $ModelObj ?? '0' !!};

        for (var sel_box_name in selboxinfo) {
            var selboxvaluelist = selboxinfo[selboxname];
            var dropdown = $("#" + sel_box_name);//find related dropdown in form
            let entitykeyvalue = (UpdateEntObj!=0) ? UpdateEntObj[selboxname] : -1;

            if(entitykeyvalue==-1)
            {
                //if there is no modelObj check old value   
                entitykeyvalue= "{{old(sel_box_name) ?? -1}}";//??? sel_box_name is undefined ERORR
                                                                                                 //sel_box_name is client side variable.
                                                                                                 
                                                                                                 //OK so I want to have list of all old value and search on 
                                                                                                  //them
            }

            dropdown.empty();
            $.each(selboxvaluelist, function (key, value) {
                dropitem=new Option(value,key);
                dropitem.selected=(key==entitykeyvalue);
                dropdown.append(dropitem);
            });
        }
    });








Sep
16
1 week ago
Activity icon

Started a new Conversation Get List Of All Old Value In *.blade.php

{{old('element_name'}} command return the old value of element in page , so in form validation if validation failed I can show the user , value entered and form element value remain.

how i could get the list of all old value in form ? may be something like this (old function without parameter)

<script>

var list_of_all_old_value = {{  old()  }};

</script>

Sep
11
2 weeks ago
Activity icon

Started a new Conversation Delete Record Using Ajax Call

i use ajax call to delete record , everything is ok, and destroy function in controller called, but in return from controller to client java script ajax error callback function executed with this error message:

"{\n    \"message\": \"The DELETE method is not supported for this route. Supported methods: GET, HEAD, POST.\",\n    \"exception\": \"Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException\",\n    \"file\": 

every this is correct just in return from server (controller) to client what happen ??

my ajax call is this:


 $.ajax({
                        type: 'DELETE',
                        headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
                        data: { "id": '10'},
                        url: controllerdestroytarget,
                        success: function (Rcvdata) {
                                  
                        },
                        error: function (data) {
                            //this function called in return, but controller destroy function do what we want and 
                           //record deleted
                            alert(data);
                        }
                    });

by the way i test to send token in data like this

var token = $("meta[name='csrf-token']").attr("content");
....   
    data: { "id": '10', "_token": token}
........

but do not solve problem

Activity icon

Replied to Retrieve Param From Returned View To Java Script Ajax Call

thank you automica , if it is possible, I have another ?, controller return list of model object (eloquent object) to view (at the result of ajax call) what is best solution to add some field to model object loaded from database and then send to client, in fact I want to add caption (user readable name) corresponding to field (attribute) saved as code in database

Activity icon

Replied to Retrieve Param From Returned View To Java Script Ajax Call

yes in fact I do something like what you say,

Controller decide return view or json ,

what I want to do is remove this logic from controller and controller always return view , then every one use this controller function retrieve what he want , in this way controller always return view , and its responsibility of user that retrieve data from controller response, to be conscious [controller do not know who call it , it always return view]

Activity icon

Replied to Retrieve Param From Returned View To Java Script Ajax Call

thank's automica

after view creation , and in client new request created and send to server with ajax , server response (what controller returned to client) is view like this:

return view('page1', compact('Param1', 'Param2'));

in client response received in ajax success method , it is big string (all html code of page1) know we want to fetch (retrieve ) just Param1 and Param2 from that big string

Activity icon

Replied to Retrieve Param From Returned View To Java Script Ajax Call

thank's automaica sorry I do not know how I could separate code region (as you say I use three backticks ''' but nothing happen)

I know how to receive param in javascript in normal state , I have ajax call that call controller function, that function return view with some param (encoded in json) now in java script (in fact in ajax success function) i receive all data of view and now i want to retrieve just param from view data received from controller .

Activity icon

Started a new Conversation Retrieve Param From Returned View To Java Script Ajax Call

after ajax call to some controller method , the result of controller function returned to ajax success callback method, controller return view like this :

{
$Param1=json_encode($Param1);
$Param2=json_encode($Param2);
$Param3=json_encode($Param3);
return view(  'page1', compact('Param1','Param2','Param3')  );
}

in ajax callback java-script function i receive string contain the page1 content,

.....
 success: function (Rcvdata) {
                //Rcvdata is the html document string of page1
                
            },
.....

HOW I can retrieve the Param1,Param2,Param3 from Rcvdata in ajax success: function ??

Sep
10
2 weeks ago
Activity icon

Replied to Get Json Data In Blade

yes it work but the result (app variable) is string, I want javascript object with

var app={!! Session::get('paramData') ?? '0' !!};

returned variable is object . thank's

Activity icon

Replied to Get Json Data In Blade

I tested

var app = @json(session('paramData', 0));

it dose not work!!! and app is string, any way thank's MichalOravec, my problem solved with this code

var param={!! Session::get('paramData') ?? '0' !!};

know param is javascript object.

I do not know why this code work , and what is deference between {!!...!!} and {{....}} any way for me {!!!!} worked

Activity icon

Replied to Get Json Data In Blade

thank's sianboon but i want to send param at redirect back

'{{ $ParamData }}';

do not get object param sened from controler

Sep
09
2 weeks ago
Activity icon

Started a new Conversation Get Json Data In Blade

I have code like this in controller.php

$Param = ['info1' => 'xxx' , 'info2' => 'xxx','info3' => 'xxx' ];

$ParamData = json_encode($Param);

return redirect()->back()->with('ParamData',$ParamData);

I want to get in *.blade.php file java object but code like this do not work ?????

var strparam='{{ Session::get('ParamData') ?? '0'}}';

var paramobj=JSON.parse(strparam);

alert(paramobj.info1);

Sep
07
2 weeks ago
Activity icon

Replied to Connection To MS SQLServer

thank's jlrdw for reply

I changed DB_HOST=localhost to DB_HOST=[computer name/sql server instance]

and problem solved , any way I do not know any reason for this

Sep
06
3 weeks ago
Activity icon

Replied to Connection To MS SQLServer

thank's jIrdw, but I do everything said in link you suggest, and installed everything that mentioned [SQL Server ODBC driver and C++ redistribution ] but error exist, and problem do not solved

Activity icon

Started a new Conversation Connection To MS SQLServer

I configure php.ini to connect to sqlserver, added needed extension :

extension=php_sqlsrv_74_nts_x64.dll

extension=php_pdo_sqlsrv_74_nts_x64.dll

and extension loaded it is OK , MS Sql server installed and TCP port is open,

.env file and database.php file configed like these:

'sqlsrv' => [ 'driver' => 'sqlsrv', 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'xxx'), 'username' => env('DB_USERNAME', 'xxx'), 'password' => env('DB_PASSWORD', 'xxx'), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, ],

DB_CONNECTION=sqlsrv DB_HOST=localhost DB_PORT=1433 DB_DATABASE=xxx DB_USERNAME=xxx DB_PASSWORD=xxx

but this is error encountered when I want to select something : "driver not found"

or if I run "php artisan migrate" I have this ERROR :

Illuminate\Database\QueryException

could not find driver (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')

at C:\inetpub\test1\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671 667| // If an exception occurs when attempting to run a query, we'll format the error 668| // message to include the bindings with SQL, which will make this exception a 669| // lot more helpful to the developer instead of just the database's errors. 670| catch (Exception $e) { 671| throw new QueryException( 672| $query, $this->prepareBindings($bindings), $e 673| ); 674| } 675|

C:\inetpub\test1\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70 PDOException::("could not find driver")

C:\inetpub\test1\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70 PDO::__construct()

thank in advance for any help.

Sep
05
3 weeks ago
Activity icon

Awarded Best Reply on Project Deployment

I found good guide about deplyment in iis in

https://jimfrenette.com/2016/09/laravel-iis-windows-install/

Activity icon

Replied to Project Deployment

I found good guide about deplyment in iis in

https://jimfrenette.com/2016/09/laravel-iis-windows-install/

Sep
04
3 weeks ago
Activity icon

Replied to Project Deployment

yes I see some of them but I do not found my answer I have 1 question:

copy entire laravel application folder to IIS inetpub folder and create new site in IIS ??

or I should do something else

Activity icon

Started a new Conversation Project Deployment

I am beginner in laravel , may be my question is very simple, any way I could not found answer in google,

I want to know how to deploy laravel application in IIS,

I installed IIS and PHP and configured IIS to load PHP run time, everything in web server is OK,

I use PhpStorm in development , after development phase must run "npm run production" and then copy

entire laravel application folder to IIS inetpub folder and create new site in IIS ??

thank you

Aug
31
3 weeks ago
Activity icon

Replied to Difference Between Session::get And {!!

Ok, Thnak Snapey

Activity icon

Replied to Difference Between Session::get And {!!

thank you. I have one more question , as I know Session object is server object repository , when we send it to view in client side how laravel manage it

and do not conflict it in request send from client

Activity icon

Replied to Difference Between Session::get And {!!

thank's manelgavalda , but when in controller have something like this :

return Redirect::back()->with('Param1', $Param1);

I could retrieve it in javascript in related *.blade.php file with this code:

var Param1={!! Session::get("Param1") ?? '' !!};

In fact I have multiple blade file and want to send them param in two type:

  1. return Redirect::back()->with('Param1', $Param1);

  2. return view('Page1')->with('param1', $param1);

thing is that in javascript in blade file to retrieve parameter for first type this code just work :

var Temp={!! Session::get("ReqInfoSelectDlg") ?? '0' !!};

and for second type this one work

var Temp={!! $ReqInfoSelectDlg ?? '0' !!};

Activity icon

Started a new Conversation Difference Between Session::get And {!!

what do exactly [with()] function ??

in controller.php when I have code like this:

return view('Page1')->with('param1', $param1);

to retrieve param1 in javascript in Page1.blade.php file this code work :

var Param1={!! $Param1 ?? '' !!};

but this one dose not work :

var Param1={!! Session::get("Param1") ?? '' !!};

dose with() function place param in session object ?

Aug
22
1 month ago
Activity icon

Awarded Best Reply on Best Practice To Show User Select List

thank's I am beginner in laravel and may be this question is not correct, I come about problem with session variable and javascript to load modal dialog something like this:

in controller :

return Redirect::back()->with('DataSelectionDlg', $SelListData)->withInput();

in blade:

@if(session()->get('DataSelDlg')) $(function(){ var Temp={!! Session::get('DataSelDlg') !!}; //fill modal dialog table and then $('#selectionModal').modal('show'); });
Activity icon

Replied to Best Practice To Show User Select List

thank's I am beginner in laravel and may be this question is not correct, I come about problem with session variable and javascript to load modal dialog something like this:

in controller :

return Redirect::back()->with('DataSelectionDlg', $SelListData)->withInput();

in blade:

@if(session()->get('DataSelDlg')) $(function(){ var Temp={!! Session::get('DataSelDlg') !!}; //fill modal dialog table and then $('#selectionModal').modal('show'); });
Activity icon

Replied to Best Practice To Show User Select List

hello this is my login controller function , user model class override with our user provider class named Employee, in login process after user name and password check user department detected and loaded and then user post must be loaded , thing is that some user have multiple post and these user must select one of them in login process , the problem is I want to render dialog to these user and they select one of the post assigned to them.

public function login(Request $request)

{

    $request->session()->regenerate();
    $credentials = $request->only(Employee::username,Employee::userpass);
    if (Auth::attempt($credentials))
    {
        $Employee = Auth::user();
        $Dep=new Department();
        if(!(new DepartmentRepository())->GetById($Employee->DepartmentId,$Dep))
        {
            return redirect()->back()->withErrors('User Deparment NotFind');
        }
        session([config('GC.EntDep') => $Dep ]);
        $DataList=[];
        if(!(new PostRepository())->GetEmpActivePost($Employee->Id,$DataList))
        {
              /*show some modal dialog to user to select one of post in $DataList only after selection of one of 
                 post in the $DataList user can login to system otherwise redirect->back()*/
        }
        session([config('GC.EntPost') => $Pos ]);

        return redirect()->home();
    }
    return redirect()->back();
}
Activity icon

Replied to Best Practice To Show User Select List

thank's jsanwo64

I want best practice for situation in which in the middle of php function execution at server side we want to get input (for example select something from list of item) from user in client and continue execution of function, what I say about user login is one sample of these situation.

Aug
21
1 month ago
Activity icon

Replied to Best Practice To Show User Select List

hello ravish

particular example for my problem is:

after authentication of users (user name and pass accepted) and before login, for some users we need show list of possible role they could login on the system, we need show dialog to these users and user select one of the possible role from list and then login to system on the base of selected role.

How I could render dialog to user in the middle of code execution in server (*.php) and ask user to input or select something thank you

Activity icon

Started a new Conversation Best Practice To Show User Select List

what is the best solution for something like this:

in execution of code in server (for example in controller.php) we reach point that user must select from some list of option , and we want to show dialog with some option so user select one of them and then execution continue,

currently I transfer code from server to client (javascript) and when selection need use modal dialog,

could I keep process in server (actually in controller.php) and just show dialog to user and after selection continue execution in server ?

Activity icon

Replied to How To Open New Tab For View Returned From Laravel Controller Function Upon Ajax Call?

Thank you for spending time with me , Sinnbeck. Yes your suggestion is possible I test it,

but how I can pass array of parameters (key/value) with window.open() to some url in fact parameters I wanf to pass is something like this

var report_param=array();

report_param['file_name'] = 'report1.xml';

report_param['report_title'] = 'something1';

report_param['report_section1'] = 'something2';

report_param['report_section2'] = 'something3';

window.open(url+report_param);

i defined web.php like this:

Route::get('/ReportViewer/{ReportParam}', '[email protected]')

Activity icon

Replied to How To Open New Tab For View Returned From Laravel Controller Function Upon Ajax Call?

thank's for response sinbeck,

because when user press button on view1 I do not have data that view2.blade must render,

the process generate data is in some function at controller.php in server and with ajax call I get them ,

view2.blade just accept data and render them, there are no process in view2.blade about loading data , view2.blade just know how to render data to user (view2.blade is report generator that accept any data (JSON) and render them) thank you

Activity icon

Replied to How To Open New Tab For View Returned From Laravel Controller Function Upon Ajax Call?

thank's yes, using window.open() is possible and do what i want,

BUT when using window.open(view2) there are two round trip to server and may be cause performance problem in page loading, when user press some button in view1 ajax request send to server and some data returned from server to client know in ajax success function if I use window.open(view2) I must send back returned data to server again (view2 blade) as parameter in window.open(view2), (in fact view2 is blade file that render report to user and I want to show it in new tab)

Aug
20
1 month ago
Activity icon

Started a new Conversation How To Open New Tab For View Returned From Laravel Controller Function Upon Ajax Call?

How to open new tab for view returned from laravel controller function upon ajax call?

I have ajax request in view1 after success of ajax call the returned result is another view2 returned

from laravel controller,

HOW in ajax success function open new tab for returned view2 from controller

OR open new tab for view2 from controller and do nothing at all in ajax success function

(what I want is to open new tab for returned view2 and keep user at current view1)

Activity icon

Started a new Conversation Stimulsoft

I want to use stimulsoft report tools in one application , stimulreport work in simple php application,

but when I want to use it in laravel framework, it has problem in redering menu bar (toolbar)

in laravel framework , I put .js and .css file of stimulreport in public folder , and .php file in app folder, and remove require_once statement from .php file and put them in composer.json autoload section,

simple application exist in

https://gitlab.com/saluei/stimultestrep

I greatly appreciate for any help.

Activity icon

Replied to Problem With Coalesce In Blade

Thank you MarianoMoreyra I change the code to this :

{{ (isset($EntObj) ? $EntObj->$GroupFieldName : '') }}

and it work ($EntObj alwayes exist) !!

Aug
19
1 month ago
Activity icon

Started a new Conversation Problem With Coalesce In Blade

$GroupFieldName='fieldname';

problem with coalesce in blade I have these line in blade file

{{$EntObj->$GroupFieldName}}

{{ $EntObj->$GroupFieldName ?? 'not defined' }}

{{$EntObj->$GroupFieldName}} exist and have value but always coalesce return 'not defined' ??

$GroupFieldName defined (returned from) in php magic __get method

public function __get($name) { if($name=='fieldname') return 'something'; }

thank you

Aug
18
1 month ago
Activity icon

Replied to Blade Null Coalesce Doesn't Work

problem with coalesce in blade I have these line in blade file

{{$EntObj->$GroupFieldName}}

{{ $EntObj->$GroupFieldName ?? 'not defined' }}

{{$EntObj->$GroupFieldName}} exist and have value but always coalesce return 'not defined' ???

thank you

Aug
17
1 month ago
Activity icon

Replied to Web Route Mess Up

Yes that's it, Thank you Sinnbeck,

I set href='/Employee' and problem solved,

I don't know the reason of this !!!

Activity icon

Started a new Conversation Web Route Mess Up

I have tow line in web.php like these:

Route::resource('Employee', 'EmployeeCtrl') Route::resource('Department', 'DepartmentCtrl')

user select Department menu bar and route to Department [Index.blade.php] address bar:

http://something.com:8080/Department

then user route to Department new insertion form [create()] function in DepartmentCtrl controller executed and [create.blade.php] view opened and google chrome address bar set to:

http://something.com:8080/Department/create?btn=btnNew

now if user click the Employee menu bar [ index() ] function in EmployeeCtrl controller executed and :

return view('Employee.Index');

I want Employee [Index.blade.php] view opened but laravel go to address:

http://something.com:8080/Department/Employee

any say PAGE NOT FIND ??

in fact I want laravel route to :

http://something.com:8080/Employee

pls help about this what is my mistake ??