vendredi 19 mars 2021

how to pass url from controller action in laravel?

Consider my current URL is

https://web.com/user/order/createOrder/200/221

I want in controller function action URL should be with different perameters

https://web.com/user/order/createOrder/100/200

how I can do this in return action of controller function my current action is

return redirect()->route('create.order')->with('success' , 'Status Changed');
   

here is my route

 Route::get('/createOrder/{id?}/{lc?}','OrderController@createOrder')->name('create.order'); 
   


via Chebli Mohamed

jeudi 18 mars 2021

how to concatenate multiple strings with commas if there is the same array data

I have the array data as drawn image description here

and I want to display data like this

0 = "16-11-1996 / IGD"
01 = "CBC", "DIFF"
04 = "GLUS "," UR "," CRE " 

I tried to use this PHP splitting arrays into groups based on equal values method but it was not what I expected.

i am just learning coding and i am not what way or what keywords should i use to find a solution. i hope someone can help me,



via Chebli Mohamed

Laravel Fetch Value form Session

Here is my Session and i would like to fetch the value from Sample_table to get the original array value how can i do that ?

 Sample_table{#266 ▼
  #fillable: array:6 [▶]
  #table: "Sample_table"
  #primaryKey: "id"
  +timestamps: true
  #connection: "mysql"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:20 [▶]
  #original: array:20 [▼
    "id" => "9"
    "firstName" => "test"
    "lastName" => "asdf"
    "middleName" => "test"
    "contactNo" => "2147483647"
    "emailAddress" => "test@gmail.com"
    "residenceAddress" => "afsf"
    "province_id" => "6"
    "city_id" => "3"
    "barangay_id" => "16982"
    "copyMailing" => null
    "mailingAddress" => null
    "mailing_province_id" => "6"
    "mailing_city_id" => "3"
    "mailing_barangay_id" => "16982"
    "status" => "0"
    "userIdentity" => "0"
    "global_id" => "0"
    "updated_at" => "0000-00-00 00:00:00"
    "created_at" => "0000-00-00 00:00:00"
  ]


via Chebli Mohamed

Unable to whitelist files due to the use of base_path() in Laravel5

I am trying to generate a code coverage report using PHPUnit. When I whitelist all the app directories for code coverage reports, the following error will be produced.

Fatal error: Uncaught Error: Call to undefined method Illuminate\Container\Container::basePath()

The base_path() function has been used in helpers and the number of controllers and each of them is producing the above error. I was able to produce a code coverage report of a file which do not use the base_path() method.

I am using PHP 7.4, Laravel 5.7, PHPUnit 7.5.30, Xdebug 3.0.3



via Chebli Mohamed

Laravel 5 can't return view static page

I'm to update a Laravel 5 template blade . I find ,ofcourse, all files in the view folder but there is a static page that it isn't there! I searched all aroud the solution but without success... This page is linked like: Ipsum To walk aroud this issue I've also tried to build a new "page.blade.php" and call it with a new link, but I get only 500 o 404 error (calling directly by route or also in by controller...). What I didn't understand?



via Chebli Mohamed

mercredi 17 mars 2021

LARAVEL - How to see if an application for user already exists

For a job board application, trying to see if an application is already present for the job post for the user so the apply button isn't displayed any longer. This is my code currently. I'm guessing I may have to pass in the $job->id somewhere? Any idea how to check this? Thanks!

@if ((auth()->user()->applications()->job()->count() >= 1)) YOU HAVE ALREADY APPLIED @else APPLY NOW @endif



via Chebli Mohamed

After running command npm-i command in laravel i started getting terminal-errors

Traceback (most recent call last): File "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\gyp\gyp_main.py", line 16, in sys.exit(gyp.script_main()) File "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 545, in script_main return main(sys.argv[1:]) File "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 538, in main return gyp_main(args) File "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 514, in gyp_main options.duplicate_basename_check) File "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 98, in Load generator.CalculateVariables(default_variables, params) File "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1916, in CalculateVariables generator_flags.get('msvs_version', 'auto')) File "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) KeyError: '2019' gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\lib\configure.js:345:16) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) gyp ERR! System Windows_NT 10.0.14393 gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd D:\O\domains\laravel\chat\node_modules\gulp-sass\node_modules\node-sass gyp ERR! node -v v14.16.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok Build failed with error code: 1 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\gulp-watch\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchify\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@3.13.1 postinstall: node scripts/build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@3.13.1 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\User\AppData\Roaming\npm-cache_logs\2021-03-17T14_39_58_121Z-debug.log



via Chebli Mohamed