nhayder

nhayder

Member Since 2 Years Ago

Doha

Experience Points
49,600
Total
Experience

400 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
350
Lessons
Completed
Best Reply Awards
2
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 10
49,600 XP
May
28
2 days ago
Activity icon

Replied to Unserialize Cart Data Not Working

@michaloravec thank you for the help :-)

its working now

May
27
3 days ago
Activity icon

Started a new Conversation Unserialize Cart Data Not Working

i'm save my cart products as unserialized data from my cart session.

        $order = new Order();

        $order->cart = serialize($cart);
        $order->code = strtoupper(str_random(15));
        $order->user_id = Auth::user()->id;

        $order->save();

now i need to unserialize the data to use it in my blade file, this is the function i'm using

        $orders = Order::with('user')->findOrFail($order->id);

        $orders->transform(function($order, $key){

            $order->cart = unserialize($order->cart);

            return $order;

        });

        dd($orders);


i'm getting this error

BadMethodCallException
Call to undefined method App\Order::transform()

what seems to be the problem? and how can i unserialize my data;

any ideas ???

Apr
04
1 month ago
Activity icon

Replied to Can't Connect To BD After Upgrading MAMP Server From 4 To 5

@jlrdw Yah nailed it this time thanks to you, I just changed the port on MAMP from 8889 to 3306 and this came back to normal.

Thanks man

Activity icon

Replied to Can't Connect To BD After Upgrading MAMP Server From 4 To 5

ok i found the fix for the problem but to tell you the truth its not a good way to solve this issue so im wondering if anybody can help me out in getting better solution for this issue.

according to this post https://stackoverflow.com/questions/46407490/laravel-no-such-file-or-directory-sql-create-table-migrations

i was able to fix the issue by adding this line of code to App/config/database.php

        'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            // 'unix_socket' => env('DB_SOCKET', ''),
            'unix_socket' => env('DB_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), <----- this is the line
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],

then i was able to connect to DB normally using these settings

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=root

can somebody explain how does that fix the problem and if there is a better fix

any ideas

Activity icon

Replied to Can't Connect To BD After Upgrading MAMP Server From 4 To 5

Yah tried that and still not connecting

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=8889
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=root
Apr
02
1 month ago
Activity icon

Replied to Can't Connect To BD After Upgrading MAMP Server From 4 To 5

I tried to change the port but still not getting connected

Activity icon

Replied to Can't Connect To BD After Upgrading MAMP Server From 4 To 5

@jlrdw what do you mean by s.o. post ????

Activity icon

Replied to Can't Connect To BD After Upgrading MAMP Server From 4 To 5

@bryank thank you for your help, this command ps -ef | grep mysqld returned

501  8076     1   0  5:54PM ??         0:00.02 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log
  501  8188  8076   0  5:54PM ??         0:01.51 /Applications/MAMP/Library/bin/mysqld --basedir=/Applications/MAMP/Library --datadir=/Applications/MAMP/db/mysql57 --plugin-dir=/Applications/MAMP/Library/lib/plugin --log-error=/Applications/MAMP/logs/mysql_error_log.err --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --socket=/Applications/MAMP/tmp/mysql/mysql.sock --port=8889
  501  9709  9703   0 10:16PM ttys002    0:00.00 grep mysqld

and this sudo lsof -Pnl +M -i | grep mysqld returned

mysqld    8188      501   32u  IPv6 0xa441e6cdfc52abd1      0t0  TCP *:8889 (LISTEN)

dos these help ????

Activity icon

Replied to Can't Connect To BD After Upgrading MAMP Server From 4 To 5

That would be a good option but I was trying to fix current problem as my priority

Activity icon

Started a new Conversation Can't Connect To BD After Upgrading MAMP Server From 4 To 5

i'm using MAMP 4.* on a macbook pro while building laravel 5.8 app, i have updated MAMP servier from 4 to 5 since then my laravel app couldn't connect to sql DB Correctly.

This is my .env file

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=root

i'm getting this error

SQLSTATE[HY000] [2002] Connection refused

Ironically ??? i can connect o to my DB using the same settings from terminal like this

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

After clearing the cache

php artisan config:clear

i'm still getting same error????

i'm struggling through this for a couple of days now i have noticed that my terminal prompt is showing different name that what i usually see

prompt

[email protected] ~ %  // and the terminal window title is zsh which is totally new to me????

i'm not sure what is MBP ??? never seen this before ????

Don't anyone been in similar situation ???

Is there is any fix for this issue ????

Mar
31
1 month ago
Activity icon

Started a new Conversation Pulling Google Fonts Through Npm Not Working But CDN Dose

in my app i'm pulling a couple of google fonts through npm like this

app.scss

// Fonts
@import url('https://fonts.googleapis.com/css?family=Amiri|Aref+Ruqaa|Baloo+Bhaijaan|Cairo|Changa|El+Messiri|Harmattan|Jomhuria|Katibeh|Lalezar|Lateef|Lemonada|Mada|Markazi+Text|Mirza|Rakkas|Reem+Kufi|Scheherazade|Tajawal');

then i did npm run production, and it look like the font where included on my compiled app.css

@import url(https://fonts.googleapis.com/css?family=Amiri|Aref+Ruqaa|Baloo+Bhaijaan|Cairo|Changa|El+Messiri|Harmattan|Jomhuria|Katibeh|Lalezar|Lateef|Lemonada|Mada|Markazi+Text|Mirza|Rakkas|Reem+Kufi|Scheherazade|Tajawal);

on my front end page i have included the compiles app.css i have this

<link href="{{ mix('/css/app.css') }}" rel="stylesheet">

now all css stylesheet are loaded correctly except google font, All font are not being changed and i cant see the effect of google fonts across the entire front end.

strangely enough if i include google fonts as CDN i can see fonts taking effects ???

any ideas ???

Mar
27
2 months ago
Activity icon

Started a new Conversation Laravel App Remote Upgrad Package

i have an app installed on multiple hosting account, I'm thinking of making a remote upgrade feature so my clients can basically click a button and their app gets upgraded automatically.

Can anybody recommend a package that does exactly that??

or maybe a tutorial link that goes through how to this type of process if i want to code it my self

any ideas

Mar
20
2 months ago
Activity icon

Started a new Conversation Axios Ajax Call Not Working On Shared Hosting But Works On Localhost

hi, i have an issue with ajax call after i deployed my app on share hosting, This function is working on local host and it giving this error on shared hosting.

"message": "The GET method is not supported for this route. Supported methods: POST.",

this is the error as i see on safari devTools

Summary
URL: http://myapp/api/widget/pullwbtnleft/
URL: http://myapp/api/widget/pullwbtnleft
Status: 405 Method Not Allowed
Source: Network
Address: 127.0.0.1:12080
Initiator: 
designer.js:256


Request
GET /api/widget/pullwbtnleft/
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Referer: http://myapp/en/admin/designer/1
Origin: http://myapp
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15
X-Requested-With: XMLHttpRequest
X-CSRF-TOKEN: MIQlRhUWynkc4GElMfPJWdbkckHd7tKNzM4ktUnF
X-XSRF-TOKEN: eyJpdiI6Imh2WWgzRlhPcmc2VDFFMVdsZ1NzRlE9PSIsInZhbHVlIjoiTmdQWTZZcGtiT0VKRndQMG9Wa2pPMm9aS2NkYzZUUnhOVEpld1M2XC9yWWFPNG5UV0txRStFQWo0ZEZZS0FxcHciLCJtYWMiOiI0OTJiOWMzZGQwMGEyMGY0NjQ5MDU5Mjg5NTllMmVhMWQ1ZjhhOTMxNTNjOGY1NjEwMGY0OTAzOTY2ZjkyNTk3In0=

Redirect Response
301 Moved Permanently
Location: http://MyApp.com/api/widget/pullwbtnleft
Date: Fri, 20 Mar 2020 08:49:47 GMT

Request
POST /api/widget/pullwbtnleft HTTP/1.1
Accept: application/json, text/plain, */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Host: MyApp.com
Origin: http://MyApp.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15
Connection: keep-alive
Referer: http://MyApp.com/en/admin/designer/1
Cookie: XSRF-TOKEN=eyJpdiI6Imh2WWgzRlhPcmc2VDFFMVdsZ1NzRlE9PSIsInZhbHVlIjoiTmdQWTZZcGtiT0VKRndQMG9Wa2pPMm9aS2NkYzZUUnhOVEpld1M2XC9yWWFPNG5UV0txRStFQWo0ZEZZS0FxcHciLCJtYWMiOiI0OTJiOWMzZGQwMGEyMGY0NjQ5MDU5Mjg5NTllMmVhMWQ1ZjhhOTMxNTNjOGY1NjEwMGY0OTAzOTY2ZjkyNTk3In0%3D; MyApp.com_session=eyJpdiI6IlI2eTRxZityZVNhbTlkUWlnbUNrQmc9PSIsInZhbHVlIjoibFVxNTFMeWNMd1pwclpoZ25BWDN0MXdUXC96a2tIcEU4QzZhME5jVTJGVmNnZzhMYUxRTUZWMkJOcTlIWWhUcWUiLCJtYWMiOiJiNGU5NWQ3ZmVkMzg0OWMyMTUzMWE1NWQxMTRiYTg2OGE1ZmZiYWY1MDhkODZkMjU5ZDczZGYxODk0Mzc5Y2RhIn0%3D; _ga=GA1.2.263094248.1584467400; _gid=GA1.2.197362391.1584624084; remember_web_59ba36addc2b2f9401580f014c7f58ea4e30989d=eyJpdiI6InJOUW1DaGFEUEFtWHZVYnF4ZUJYV0E9PSIsInZhbHVlIjoiZWJIdVwvVGFqZlpLRWlXWmlBSjJZMnJQY1UzT1lBalpQNE5ZYWhxTXc4VWJrSzZ5emljVUNLZGlYZmdcL09NeGJ1b3RDYVNqRzAwRjcwd1wvaTV0V08rQm5MNmg5TUt3R2lOSncwQzAzTGJSdTRqRHlneG9ab2R1ZWZsWUtrbE5jWnczWnZLbHllUENGdk1OUFNkT3Rsa2hPYlcxYW91WlYzcm1WMzlZRU5DbUtFPSIsIm1hYyI6IjUzOTdiYzk4Y2ZlNzIxOTYyOGNmMWFmZmQ0NmUxMjQzNGIwMzIzZTBmOTVkZTc1YWQ0NWNhOTViZmNhMzUxMjcifQ%3D%3D
X-Requested-With: XMLHttpRequest
X-XSRF-TOKEN: eyJpdiI6Imh2WWgzRlhPcmc2VDFFMVdsZ1NzRlE9PSIsInZhbHVlIjoiTmdQWTZZcGtiT0VKRndQMG9Wa2pPMm9aS2NkYzZUUnhOVEpld1M2XC9yWWFPNG5UV0txRStFQWo0ZEZZS0FxcHciLCJtYWMiOiI0OTJiOWMzZGQwMGEyMGY0NjQ5MDU5Mjg5NTllMmVhMWQ1ZjhhOTMxNTNjOGY1NjEwMGY0OTAzOTY2ZjkyNTk3In0=
X-CSRF-TOKEN: MIQlRhUWynkc4GElMfPJWdbkckHd7tKNzM4ktUnF

Response
HTTP/1.1 405 Method Not Allowed
Content-Type: application/json
Cache-Control: no-cache, private
Vary: Accept-Encoding,User-Agent
Date: Fri, 20 Mar 2020 08:49:48 GMT
Content-Encoding: gzip
Keep-Alive: timeout=5, max=99
Content-Length: 718
Connection: Keep-Alive
Server: Apache
Allow: POST

Request Data
MIME Type
Request Data: 

this is the function on vuex

        async pullWbTNleft({commit}, [id, sort, wID, wIndex]){
            
            commit('WORK_ON');

            await axios.post('/api/widget/pullwbtnleft/', {

                id: id,

                sort : sort,

                wID : wID,

            })

            .then(function (response) {

                commit('PULL_W_BTN_LEFT', [wIndex, response.data])

            })

            .catch(function (error) {

                Event.$emit('requestAlertDanger'); 

            });

        },

this is the route

	Route::post('/widget/pullwbtnleft', '[email protected]');

this is the pullWidgetBtnLeft function

    public function pullWidgetBtnLeft(Request $request)
    {
    
        $request->validate([

            'id' => 'required|integer',

            'sort' => 'required|integer',

            'wID' => 'required|integer',

        ]);

        
        // code logic goes here

    }

can anyone see what the problem is ????

and how to fix this issue ???

Mar
17
2 months ago
Activity icon

Replied to Laravel Mix Is Not Complying Font Awesome Properly

@rodrigo.pedra thanx man, it was a very informative conversation with you, ;-)

Activity icon

Replied to Laravel Mix Is Not Complying Font Awesome Properly

@rodrigo.pedra yah thank you it worked and i can see the fonts inside webfonts folder and all fonts on my app are back to live again.

It was definitely a practical work around but i was hoping to fix the compiler instead to copying files by webpack.mix.js

any idea on how to fix this ????

Activity icon

Replied to Laravel Mix Is Not Complying Font Awesome Properly

@rodrigo.pedra just tried to copy webfonts folder to public and i got all icons back ????

what do you think the problem is ????

Activity icon

Replied to Laravel Mix Is Not Complying Font Awesome Properly

@rodrigo.pedra thank you for your replay, .. I have commented this

$fa-font-path: "../webfonts";

after the compilation is completed i searched for @font-face and i found 4 of them as expected

@font-face {
  font-family: 'Font Awesome 5 Free';
  font-style: normal;
  font-weight: 900;
  font-display: auto;
  src: url("../webfonts/fa-solid-900.eot");
  src: url("../webfonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.woff") format("woff"), url("../webfonts/fa-solid-900.ttf") format("truetype"), url("../webfonts/fa-solid-900.svg#fontawesome") format("svg");
}

.fa,
.fas {
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
}

/*!
 * Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 */

@font-face {
  font-family: 'Font Awesome 5 Free';
  font-style: normal;
  font-weight: 400;
  font-display: auto;
  src: url("../webfonts/fa-regular-400.eot");
  src: url("../webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../webfonts/fa-regular-400.woff2") format("woff2"), url("../webfonts/fa-regular-400.woff") format("woff"), url("../webfonts/fa-regular-400.ttf") format("truetype"), url("../webfonts/fa-regular-400.svg#fontawesome") format("svg");
}

.far {
  font-family: 'Font Awesome 5 Free';
  font-weight: 400;
}

/*!
 * Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 */

@font-face {
  font-family: 'Font Awesome 5 Brands';
  font-style: normal;
  font-weight: 400;
  font-display: auto;
  src: url("../webfonts/fa-brands-400.eot");
  src: url("../webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../webfonts/fa-brands-400.woff2") format("woff2"), url("../webfonts/fa-brands-400.woff") format("woff"), url("../webfonts/fa-brands-400.ttf") format("truetype"), url("../webfonts/fa-brands-400.svg#fontawesome") format("svg");
}

.fab {
  font-family: 'Font Awesome 5 Brands';
  font-weight: 400;
}
Activity icon

Started a new Conversation Laravel Mix Is Not Complying Font Awesome Properly

this should be easy but yet its not working for me, i'm using laravel 5.8 to build me app and i need to compile font awesome through npm.

the package is already added to the app but after npm run? it looks like font are missing across my app.

this is my app.scss as per fontawesome documentation

// [email protected]
$fa-font-path: "../webfonts";

@import '[email protected]/fontawesome-free/scss/fontawesome.scss';
@import '[email protected]/fontawesome-free/scss/solid.scss';
@import '[email protected]/fontawesome-free/scss/regular.scss';
@import '[email protected]/fontawesome-free/scss/brands.scss';

when i run npm run dev i can't see icons on the front end site neither i can find font folder on the public folder.

on chrome devTools i have this error

Failed to load resource: the server responded with a status of 404 (Not Found) 
fa-solid-900.woff2:1 // basically the font is missing ???

// and this error also whitch mean the same
GET http://127.0.0.1:8000/webfonts/fa-solid-900.ttf net::ERR_ABORTED 404 (Not Found)

any ideas on what is going on ???

Mar
15
2 months ago
Activity icon

Replied to Laravel Mix Not Compiling Tailwindcss V0.7.4 @apply Directives

@sinnbeck oh, I got you now, but it might be from copying and pasting from my code to this post body, I might have missed the ; at the end,

Because I have checked original code and it’s there

Activity icon

Replied to Laravel Mix Not Compiling Tailwindcss V0.7.4 @apply Directives

@sinnbeck can you please clarify where did I miss the a, it’s not clear to me from your post

Activity icon

Started a new Conversation Laravel Mix Not Compiling Tailwindcss V0.7.4 @apply Directives

i'm having an issue with compiling tailwindcss v0.7.4 in my laravel 5.8 app, in my webpack.js i have this

	var tailwindcss = require('tailwindcss');

	mix.js('resources/assets/js/app.js', 'public/js')

		.sass('resources/assets/sass/app.scss', 'public/css')

		.options({

			processCssUrls: false,

			postCss: [ tailwindcss('./tailwind.js') ],

		});


then on my app.scss i have tailwind directive like this

@tailwind preflight;

@tailwind components;
	.shadow-style-sm {

  		@apply appearance-none no-underline border border-grey-light cursor-pointer

	}
@tailwind utilities;

when i run npm run dev i'm i'm getting this error

 ERROR  Failed to compile with 1 errors                                                                                                              15:14:08

This dependency was not found:

* /Applications/MAMP/htdocs/myapp/resources/assets/sass/app.scss in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

To install it, you can run: npm install --save /Applications/MAMP/htdocs/myapp/resources/assets/sass/app.scss
                                                                               Asset       Size  Chunks                    Chunk Names
  images/vendor/lightgallery.js/dist/video-play.png?4f03bd8dec67211ade8abdab39dcbf4a  819 bytes          [emitted]         
           fonts/vendor/lightgallery.js/dist/lg.eot?ecff11700aad0000cf3503f537d1df17    4.02 kB          [emitted]         
           fonts/vendor/lightgallery.js/dist/lg.ttf?4fe6f9caff8b287170d51d3d71d5e5c6    3.88 kB          [emitted]         
          fonts/vendor/lightgallery.js/dist/lg.woff?5fd4c338c1a1b1eeeb2c7b0a0967773d    3.96 kB          [emitted]         
     images/vendor/lightgallery.js/dist/loading.gif?0aeca8b09888accfccf11976b34c4e64     3.8 kB          [emitted]         
           fonts/vendor/lightgallery.js/dist/lg.svg?c066c5448562b3ccaefb6408ce4b4ae1    8.86 kB          [emitted]         
  images/vendor/lightgallery.js/dist/vimeo-play.png?699d005153517ee4264615dd1e4e2b64    1.48 kB          [emitted]         
images/vendor/lightgallery.js/dist/youtube-play.png?96bc9d7e27d077372cc0bc9524c500e6     2.7 kB          [emitted]         
                                                                          /js/app.js     1.6 MB       0  [emitted]  [big]  /js/app
                                                                   /css/app.css    2.69 MB          [emitted]         
                                                                     /js/app.js    3.24 MB          [emitted]         

ERROR in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
Module not found: Error: Can't resolve '/Applications/MAMP/htdocs/myapp/resources/assets/sass/app.scss' in '/Applications/MAMP/htdocs/myapp'
 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ development 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!     /Users/hassanmansoor/.npm/_logs/2020-03-15T12_14_09_976Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ dev 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!     /Users/hassanmansoor/.npm/_logs/2020-03-15T12_14_09_992Z-debug.log
najems-MacBook-Pro:myapp hassanmansoor$

it looks like the @ from @apply directive is breaking the code????

any ideas on how to solve this issue ???

Mar
14
2 months ago
Activity icon

Replied to How To Combine Tailwind Css With Animate.css Using Laravel Mix

@sinnbeck i know about that package but i'm trying to find a better solution without using packages.

i'm sure somebody has been in the same situation on this forum

Activity icon

Started a new Conversation How To Combine Tailwind Css With Animate.css Using Laravel Mix

i'm using tailwindcss as my main css framework and i need to add animate.css to add some animation

https://daneden.github.io/animate.css/.

my question is how to combine both framework for my app using laravel mix ????

this is my laravel mix file

	var tailwindcss = require('tailwindcss');

	mix.postCss('resources/assets/admin/css/designer.css', 'public/css', [

	  tailwindcss('./tailwind.js'),
	  
	]);

	mix.js('resources/assets/js/app.js', 'public/js/app.js').version();

Any ideas on how to do this ???

Activity icon

Replied to How To Run Queues On Shared Hosting

@snapy you wrote

your cpanel cron could run the queue worker directly, (you don't need to do this with the laravel scheduler

how can cpanel could run a queue worker directly, Do you mean on a seperate route (auth route) where i can create new controller containing logic ??

myapp.com/admin/cronjobs // cron can hit this route

// in cronController i can do this
Artisan::call('queue:work --stop-when-empty');

can you expand on this note please, most likely i'm moving in this direction (without laravel scheduler )

Activity icon

Replied to How To Run Queues On Shared Hosting

@snapey thank you for the informative replays, I will try this and let you know if there is any further help

Activity icon

Replied to How To Run Queues On Shared Hosting

@snapey just want to clarify the process here,

So let's say the cron job has started and it triggered the queue to process tasks

this will stop die/ kills the queue when they are empty

php artisan queue:work --stop-when-empty

then after lets say 1 minute the cron job will start another queue and it will die when the queue is empty.

is that what your saying @snapy ????

if yes that would be really good implementation to do.

did i understood you correctly ???

your question : How often you repeat this depends how busy the queue is.

my answer : i think a frequency of every minute will be fine

Mar
13
2 months ago
Activity icon

Replied to How To Run Queues On Shared Hosting

@snapey yes i can setup cron job

Activity icon

Replied to How To Run Queues On Shared Hosting

Yah but again i can SSH into the APP and simply type

php artisan queue:work

This will run the queue and it will stay working as long as the app is alive ???

what does everybody think of implementation this ????

Mar
11
2 months ago
Activity icon

Started a new Conversation How To Run Queues On Shared Hosting

i have an app hosted on a cPanel dedicated hosting account and i need to setup a cron jobs to run my laravel queues.

this is the first time i do this type of implementation so i needed some help to understand how to do this type of implementation.

The queues are fully working as expected on my local computer so the laravel part of this implementation is done :-) and on cPanel ??? i can create a cron job to run every minute.

But my question is, how to run php artisan queue:work from cPanel cron job, so my worker can process queued tasks

any ideas

Feb
09
3 months ago
Activity icon

Started a new Conversation Vue.js Is Showing Error During Loading Of Image Src (404 (Not Found))

Hi, i'm seeing an error on 3 of my vue components

GET http://127.0.0.1:8000/image/md/ 404 (Not Found)

this is the image as i have it on the component

<div class="w-full px-3 mb-6 md:mb-0">

    <label class="uppercase mb-2">Image</label>

    <img :src="thumbnail()" class="my-3">

</div>

the thumbnail() method is being executed like this


methods: {

        thumbnail : function(){

            var url = this.smcard;

            if (url == '/media/default/placeholder.png') {

                return url;

            }else{

                console.log('URL ='+url); 

                return '/image/md/'+url;

            }

        },

}

the console.log('URL ='+url); is showing empty value which is causing the component to show 404 not found error.

But after loading the component i can see the proper image being loaded properly on the page.

any idea on how to fix this issue.

Jan
24
4 months ago
Activity icon

Replied to AJAX Call Not Working Of Safari But Working On Chrome

@snapey this is the request data

Request Data
MIME Type: application/x-www-form-urlencoded; charset=UTF-8
id: 43
article_id: 3
_token: nwqdqLgASjsCF1auWO0OBiDV4huG0Fj5KiarFfvk
Activity icon

Replied to AJAX Call Not Working Of Safari But Working On Chrome

@snapey this is what being send using developers/network/json


exception: "Symfony\Component\HttpKernel\Exception\HttpException"

file: "/Applications/MAMP/htdocs/app/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php"

line: 208

message: "CSRF token mismatch."

trace: [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, …] (43) ...etc

Activity icon

Started a new Conversation AJAX Call Not Working Of Safari But Working On Chrome

I'm using jquery to delete a user logs, My code is working on chrome and i can remove all logs as expected but with safari i'm getting this error

{
    "message": "CSRF token mismatch.",
    "exception": "Symfony\Component\HttpKernel\Exception\HttpException",
    "file": "/Applications/MAMP/htdocs/app/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
    "line": 208,
    "trace": [
        ...
    ]
}

this is my jquery ajax code

        $('#deleteUserLogHistory').on('show.bs.modal', function (event) {

          var button = $(event.relatedTarget)

          var elemID = button.data('id')
          
          var modal = $(this)

          modal.find('.delete-user-Log').val(elemID)

            // delete function
            $(".delete-user-Log").click(function(){

                // get item id
                var id = $(this).val();

                // get token value
                var token = $("meta[name='csrf-token']").attr("content");

                // deleting item
                $.ajax(
                    {
                        url: "/admin/logs/user/delete/"+id,

                        type: 'DELETE',

                        data: {

                            "id": id,

                            "_token": token,

                        },

                        success: function (){

                            // reload Page
                            location.reload();
                            
                        }

                    });

            });

        })

This is the method on my controller

    public function destroyUserRecords($id)
    {

        if (Gate::denies('activities.delete')) {
            
            return abort(403);
        
        }

        $delete = Activity::where('user_id', '=', $id);

        $delete->delete();

    }

Can anyone see a problem with me code, Before safari is not working?

Jan
20
4 months ago
Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@fylzero yes i do have is it on the top of the page, otherwise it won't work on chrome, but if you mean the first line at the top??? i put it at the top first line and still not being able to get the data properly i'm still getting

[]
Jan
19
4 months ago
Activity icon

Started a new Conversation Safari Is Stripping Data From My Response Object

I've been facing this problem for sometime now and i'm hoping to find the if anybody faced same issue.

i'm using laravel 5.8 with vue + vuex.

in my app i have vue function that saves text on the page to a DB whitch is working fine on chrome and firefox.

Unfortunitly the code is not working on safari and as result of that i'm getting empty object [] instead of what i'm expecting.

this is my code

    saveText({commit}, [id, text, name, wIndex]){

        axios.put('/admin/designer/api/test/', {

            elem: text,

            elemName : name,

            elemId: id,

        })

        .then(function (response) {

            commit('UPDATE_W_ELEM', [name, wIndex, response.data]);

        })

        .catch(function (error) {

            Event.$emit('requestAlertDanger'); 

        });

    },

now in safari/network i have check the request data and they are available on the browser as expected

{
    "elem":"INTR O WIDGET","
    elemName":"title",
    "elemId":6
}

Then i'm hitting the text route and in my controller i have just simple it worked spitted out

    public function test(Request $request)
    {

        return 'Worked';

    }

And i can see the work worked available on the page, so basically the data are being submitted properly and received as expected in safari.

all good till this point.

NOW i need to work with actual data so i can save them into the database?

so i replace the (worked ) with actual data like $request->all(); but i'm [ ] empty response object on network response tab ( Resource has not content ) and data is empty ???

    public function test(Request $request)
    {

        return $request->all(); // returning blank/empty 

    }

Any ideas on how to fix this issue????

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov yes i have some middlewares but i'm getting same results with or without.

please do let me know if you have a fix.

All the best

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov i have check the return $request->all(); and this was the result []

[ ]

empty

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov hi, I have made great improvements regarding my safari problem. after yesterday's discussion, and i was able to see data passed from my component to the controller.

Note i'm using laravel 5.8 with vue.js and vuex as my main javascript library across my app.

i will try to brief you about what i did so both of us will be on the same page.

this is almost same function but i made a test route for is

         saveText({commit}, [id, text, name, wIndex]){

            axios.put('/admin/designer/api/test/', {

                elem: text,

                elemName : name,

                elemId: id,

            })

            .then(function (response) {

                commit('UPDATE_W_ELEM', [name, wIndex, response.data]);

            })

            .catch(function (error) {

                Event.$emit('requestAlertDanger'); 

            });

        },

now in safari/network i have check the request data and they are available on the browser as expected

{
    "elem":"INTR O WIDGET","
    elemName":"title",
    "elemId":6
}

Then i'm hitting the text route and in my controller i have just simple it worked spitted out

    public function test(Request $request)
    {

        return 'Worked';

    }

And i can see the work worked available on the page, so basically the data are being submitted properly and received as expected in safari.

all good till this point.

NOW i need to work with actual data so i can save them into the database?

so i replace the (worked ) with actual data like $request->elem; but i'm getting white space in the network response tab ( Resource has not content ) and data is empty ???

    public function test(Request $request)
    {

        return $request->elem; // returning blank/empty 

    }

i hope i was able to explain it to you?

and do let me know if you think there is a fix for this

Jan
18
4 months ago
Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov Thank you man i will definitely check it out and let you know soon

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@fylzero it's a long file i just copied and pasted part of it, the part where you need to see the actual route.

i have some admin group and designer group then come the api group that one you are looking at above

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@fylzero you are exactly correct on this.

i just can't make it work

i tried everything but its not working.

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov @fylzero this is my route as i'm sying it on web.php

Route::prefix('api')->group(function (){

    Route::put('/widget/text', '[email protected]');

});

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov this is what is showing on the network tab when hitting the route


{
    "message": "The given data was invalid.",
    "errors": {
        "elem": [
            " field elem required."
        ],
        "elemName": [
            " field elem name required."
        ],
        "elemId": [
            " field elem id required."
        ]
    }
}

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@fylzero yes tried them all , patch, post, put, all of the as passing empty array on safari but they work as they should be on chrome

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov this line

return $request;

was removed from the code, it was just for testing.

it's not there anymore i was explaining how things work

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@fylzero i'm hitting that end point in chrome ?????

NOT SAFAR ???

the code is fully working on chrome and firefox

Activity icon

Replied to Axios Ajax Call Not Working Working On Chrome But Working Safari

@nakov please read the hall conversation the

return $request;

was temperary just to check if i'm getting any data from axios.

you can read my initial post for permanent code as i have it on my app