behnampmdg3

behnampmdg3

Member Since 5 Years Ago

Experience Points 21,900
Experience Level 5

3,100 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 90
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.

17 Apr
1 month ago

behnampmdg3 left a reply on Php Artisan Serve ErrorException : Chdir(): No Such File Or Directory (errno 2)

@SNAPEY - Hi;

It works well on the server and the issue is the local version.

I do updates on the code and I am working with Git to push.

I want to both do this locally and when updates are done, then push.

Thanks

behnampmdg3 left a reply on Php Artisan Serve ErrorException : Chdir(): No Such File Or Directory (errno 2)

@SNAPEY - I uploaded the app ti the server but there are no proper instructions on how to do this.

It's recommended to keep .env and everything but the content of public out of public_html on a directory above.

That causes a whole lot of issues like this one.

I did what Munazzil said but now the assets can't be found.

behnampmdg3 started a new conversation Php Artisan Serve ErrorException : Chdir(): No Such File Or Directory (errno 2)

Hi;

Why do i get this?

The solutions I find suggest to update Kernel and server file.

Does not seem right.

php artisan serve

   ErrorException  : chdir(): No such file or directory (errno 2)

  at /Users/***/codes/goldmembers/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php:42
    38|      * @throws \Exception
    39|      */
    40|     public function handle()
    41|     {
  > 42|         chdir(public_path());
    43| 
    44|         $this->line("Laravel development server started: <http://{$this->host()}:{$this->port()}>");
    45| 
    46|         passthru($this->serverCommand(), $status);

  Exception trace:

  1   chdir("/Users/***/codes/goldmembers/public_html")
      /Users/***/codes/goldmembers/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php:42

  2   Illuminate\Foundation\Console\ServeCommand::handle()
      /Users/***/codes/goldmembers/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
11 Apr
1 month ago

behnampmdg3 left a reply on Specified Key Was Too Long; Max Key Length Is 767 Bytes

Thanks Tykus;

Upgrade your MySQL/MariaDB version

10 Apr
1 month ago

behnampmdg3 started a new conversation Specified Key Was Too Long; Max Key Length Is 767 Bytes

Hi;

Importing the database and Sequel pro says

Specified key was too long; max key length is 767 bytes

What is the right way of setting that globally so I don't have to do it for every table?

I don't wanna just change /etc/my.conf.d without checking first.

Thanks

09 Apr
1 month ago

behnampmdg3 left a reply on Where Is A Full Instructions On How To Deploy A Working Local App To The Server?

@SNAPEY - This is good thanks.

What I am interested in is a vidoe that explains how to do the whole .env file and git stuff plus renaming public_html on the server etc. All the details.

behnampmdg3 started a new conversation Would It Be Right To Add .env To .gitignore And Update It Via Vim On The Server?

.env is sitting on the directory above public.

To update it, would it be correct to add .env to .gitignore and update it via vim on the server?

Thanks

behnampmdg3 left a reply on /public_html/cache/files Permissions

@JKENYON - This is on local:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required '/Users/****/codes/goldmembers/server.php' (include_path='.:/usr/local/Cellar/php/7.2.11/share/php/pear') in Unknown on line 0

https://ibb.co/Lxv8Hn3

behnampmdg3 left a reply on How To Track Down This Digit Printed On Screen?

@SNAPEY - I did and if I tell you you're gonna kill me! It was on the top of the app view file! I made it clear it is NOT the view.

08 Apr
1 month ago

behnampmdg3 left a reply on How To Track Down This Digit Printed On Screen?

Hi;

Currently that's the least of my problems. Still the back of my mind.

Need to sort out the site structure. It looks like I need 2 git commands to push public to public_html and 1 push to do everything else. Once I sort that out then I get back to the app itself. Coding is so much more fun than server stuff.

behnampmdg3 left a reply on /public_html/cache/files Permissions

@CRONIX - ``` My directory structure is exactly like laravels. The /public dir would be the equivalent to your /public_html and everything else should be above that and not directly accessible.


Yes this is correct. and I got this working now however there are 2 things:

1 - To achieve this I need 2 git commands for deploy. 

1 to push the content of public directory to "public_html" and 1 to push everything else.

2 - To keep things clean, I tried to keep everything else (not the public) inside another directory and call it "laravel-files". Then everything started to fall apart. All links, artisan etc etc.

Does you directory about public_html look messy?

behnampmdg3 left a reply on /public_html/cache/files Permissions

@CRONIX - Yeh they don't support for 3rd party apps which is strange.

How do you structure your directories? I read in a few places to put the content of public in public_html and everything else is laravel_backed directory or something.

What do you think of that?

In that case when I try php artisan serve I get

 php artisan serve

   ErrorException  : chdir(): No such file or directory (errno 2)

  at /Users/behnamjazayeri/codes/goldmembers-copy/laravel-back/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php:42
    38|      * @throws \Exception
    39|      */
    40|     public function handle()
    41|     {
  > 42|         chdir(public_path());
    43| 
    44|         $this->line("Laravel development server started: <http://{$this->host()}:{$this->port()}>");
    45| 
    46|         passthru($this->serverCommand(), $status);

  Exception trace:

  1   chdir("/Users/iii/codes/goldmembers-copy/laravel-back/public")
      /Users/iii/codes/goldmembers-copy/laravel-back/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php:42

  2   Illuminate\Foundation\Console\ServeCommand::handle()
      /Users/iii/codes/goldmembers-copy/laravel-back/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32

  Please use the argument -v to see more details.

I don't think it would be the right thing to change ServeCommand.php file.

behnampmdg3 left a reply on /public_html/cache/files Permissions

@STEREOH - Hey man, you seem a bit tense for some reason.

8000exp doesn't mean much if it's bad advice.

My questions get quite a lot of hits. Seem to be useful to other beginners.

And let's not use words like dumb even if we have different opinions.

Peace

behnampmdg3 left a reply on Where Is A Full Instructions On How To Deploy A Working Local App To The Server?

I am surprised there is no proper instructions on this. I can't even find recent videos on Laracasts series.

behnampmdg3 left a reply on Where Is A Full Instructions On How To Deploy A Working Local App To The Server?

I am using Softaculous. After instal, this is the directory structure it creates:

https://ibb.co/CtcMt36

behnampmdg3 left a reply on /public_html/cache/files Permissions

Not long ago the quality of responses in Laracast used to be so much better.

Now everyone with no experience posts random inaccurate replies just to collect reputation.

behnampmdg3 started a new conversation SSH Logs Out Randomly Pretty Much After Each Command. Broken Pipe

Why does it log out randomly? Even after doing basic commands like ls -la

[[email protected] cache]$ ls -la
total 16
drwxr-xr-x  4 mygoldmembers mygoldmembers 4096 Apr  6 22:18 .
drwxr-x--- 15 mygoldmembers nobody        4096 Apr  7 21:12 ..
drwxr-xr-x  2 root          root          4096 Apr  6 22:18 files
drwxr-xr-x  3 root          root          4096 Apr  6 22:18 repo
[[email protected] cache]$ Write failed: Broken pipe
Behnams-MBP-2:goldmembers$

behnampmdg3 started a new conversation /public_html/cache/files Permissions

What should be the permissions for

/public_html/cache/files
/public_html/cache/repo

I get this

[[email protected] public_html]$ composer update
Cannot create cache directory /home/mygoldmembers/public_html/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/mygoldmembers/public_html/cache/files/, or directory is not writable. Proceeding without cache

behnampmdg3 left a reply on You Made A Reference To A Non-existent Script @/usr/local/bin/php Artisan Package:discover --ansi

@CRONIX - Hi;

Yes there is a 1 click Laravel installation on Cpanle they highly recommend to use that it looks like this:

https://ibb.co/Mnfn7yS

Softaculious

So you click and you have a fresh install of Laravel.

Here is what it shows: http://tinyurl.com/y2zwdony

What other info do you need?

07 Apr
1 month ago

behnampmdg3 started a new conversation You Made A Reference To A Non-existent Script @/usr/local/bin/php Artisan Package:discover --ansi

[[email protected] public_html]$ composer update Cannot create cache directory /home/mygoldmembers/public_html/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache Cannot create cache directory /home/mygoldmembers/public_html/cache/files/, or directory is not writable. Proceeding without cache Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump You made a reference to a non-existent script @/usr/local/bin/php artisan package:discover --ansi

behnampmdg3 left a reply on Batch Insert

@CRONIX - ``` SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list' (SQL: insert into lesson_tags (0, 1, 2) values (tenniiis, chess, sports))


dd($lesson_tags);

array:3 [▼ 0 => array:2 [▼ "tag" => "tenniiis" "lesson_id" => 707 ] 1 => array:2 [▼ "tag" => "chess" "lesson_id" => 707 ] 2 => array:2 [▼ "tag" => "sports" "lesson_id" => 707 ] ]


The whole code:
    $lesson = new Lesson;
    $lesson->title = $request->title;
    $lesson->description = $request->description;
    $lesson->release_after = $request->release_after;
    $lesson->module_id = $request->module_id;
    $lesson->video_link = $request->video_link;
    $lesson->sort = 1;
    $lesson->user_id = \Auth::id();
    $lesson->save();   
    $lesson_id = $lesson->id;
    //Insert tag
    if(strlen($request->tags)>0 && strpos($request->tags, ',') !== false)
        {
            $request->tags = str_replace(' ', '', $request->tags);
            $tags = explode(",", $request->tags);
            foreach($tags as $tag)
                {
                    $lesson_tags[] = ['tag' => $tag, 'lesson_id' => $lesson_id];
                }
        \DB::table('lesson_tags')->insert([$lesson_tags]);    
        }

behnampmdg3 left a reply on How To Track Down This Digit Printed On Screen?

Searching 9636 files for "1<?php"

0 matches

I have "echo"ed something somewhere.

behnampmdg3 started a new conversation How To Track Down This Digit Printed On Screen?

It's a bit of a silly question but how do you find this piece of code?

Best strategy to find this "1"?

https://ibb.co/sb7MN51

It's not in the views.

behnampmdg3 started a new conversation Where Is A Full Instructions On How To Deploy A Working Local App To The Server?

Hi;

I have a working app on local app. Now I got a nice server, connected to git and ready to push.

A lot of things go wrong without clear instructions. Composer not working properly Not sure which files to upload which to ignore etc etc

Where is a full instructions on how to deploy a working local app to the server?

Thanks

behnampmdg3 left a reply on Do Not Run Composer As Root/super User!

Well the thing is I get

composer update
Composer could not find a composer.json file in /home/mygoldmembers
06 Apr
1 month ago

behnampmdg3 started a new conversation Do Not Run Composer As Root/super User!

Hi;

I was getting 500 page => https://ibb.co/j4Qt23f

So I

composer update

Fixed it locally.

Then pushed to the main server and I get the same 500 page => https://ibb.co/j4Qt23f

So I

composer update

and now I get this on the server

composer update
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Composer could not find a composer.json file in /home/mygoldmembers

Composer page doesn't really explain what's up. What can i do?

Thanks

behnampmdg3 started a new conversation Has Anyone Tried Installing Laravel On Liquid Server Dedicated Using Softaculous?

Has anyone tried installing Laravel on Liquid server dedicated using Softaculous?

This is the server:

https://manage.liquidweb.com/manage/signup/configure.html?config_id=1090&zone_id=27&product=SS.VPS#stormssd

If you have please advise.

behnampmdg3 left a reply on Best Laravel Video Player That Works With Amazone S3?

@SHEZ1983 - I am asking for a player that connects to S3 via Laravel.

behnampmdg3 started a new conversation Batch Insert

How can I insert $lesson_tags into the database? Obviously this array is wrong.

if(strlen($request->tags)>0 && strpos($request->tags, ',') !== false)
            {
                $request->tags = str_replace(' ', '', $request->tags);
                $tags = explode(",", $request->tags);
                foreach($tags as $tag)
                    {
                        $lesson_tags[]=array('tag','lesson_id');
                    }
            \DB::table('lesson_tags')->insert([$lesson_tags]);    
            }

Thanks

05 Apr
1 month ago

behnampmdg3 started a new conversation Auth::user()->name

Does this run a query each time? Or is it through session etc?

Auth::user()->name
04 Apr
1 month ago

behnampmdg3 left a reply on Best Laravel Video Player That Works With Amazone S3?

@VANDAN - Dude I am asking for a player not a file uploader. Do you even read the question? lol

behnampmdg3 started a new conversation Best Laravel Video Player That Works With Amazone S3?

Best Laravel video player that works with Amazone S3?

03 Apr
1 month ago

behnampmdg3 left a reply on Vue Vs Jquery With Laravel... An Honest Performance And Easy Of Use Comparison

@FTIERSCH - What I want is the easiest way to load content from the database into parts of the page.

I know ajax with Jquery but I am sure there are easier ways.

For example, look at this mess

Just sampe code... not real

$('.up_button').on('click', function () {
                   
                            //Post some variables
   
                            $.ajaxSetup({
                            headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                            });
                            $.ajax({
                                type:'post',
                                url: '/lessons/more',
                                data:  { from: las_id}
                            });
                        }
                });



public function ShowMore($lesson) { //Add validation $last_lesson = \DB::select(' SELECT * FROM lessons WHERE id = ?', [$lesson]); $next_ten = \DB::select('SELECT * FROM lessons WHERE module_id = ? AND sort > ? LIMIT 2', [$last_lesson[0]-> module_id, $last_lesson[0]->sort]); $append=""; foreach($next_ten as $val) { $append .= '

  • '.$val->title.''.$val->id.'Release after '.$val->release_after.' day(s) '.$val->id.'
  • '; $last = $val->id; $last_sort = $val->sort; $last_module = $val->module_id; } $next_ten = \DB::select('SELECT * FROM lessons WHERE module_id = ? AND sort >= ?', [$last_module, $last_sort]); $response = array($append, $last, count($next_ten)); return $response; }

    
    
    This is not good..
    

    behnampmdg3 started a new conversation Vue Vs Jquery With Laravel... An Honest Performance And Easy Of Use Comparison

    What are some major benefits of using Vue Vs Jquery with Laravel?

    I looked at some very basic Vue code and it looks like you gotta write quite a lot to do something very small.

    Of course, there is a lot into it.

    Shed some light.

    Peace

    02 Apr
    1 month ago

    behnampmdg3 started a new conversation WHERE On Eloquant Relatgionships And Return Objection Not Collection

    How can we get all the active modules where active = 1?

    public function edit(Course $course)
        {
                   $modules = $course->modules;
        }
    
    class Course extends Model
    {
        public function modules()
        {
            return $this->hasMany('App\Module')->orderBy('sort');
        }
    }
    

    The main problem is when using ->get(); on relationships then everything changes. Collections are different from normal objections ->first() returns.

    behnampmdg3 left a reply on Issue With Summernote

    @MAVERICKCHAN - Not like that :0

    View

    <div id = "{{ $lesson->id }}_description" class="hide-this">{!! $lesson->description !!}</div>
    

    Js file

    $('.lesson_description').summernote('reset');
    var HTMLstring = $('#'+id+'_description').html();
    $('.lesson_description').summernote('insertText', HTMLstring);
    
    01 Apr
    1 month ago

    behnampmdg3 left a reply on Issue With Summernote

    @NAKOV - Still the same

    behnampmdg3 left a reply on How To Display This Data Using Arrays Inside Blade?

    @MO7SIN - Yes, it is.

    Please don't post replies if it's not related to the question.

    behnampmdg3 started a new conversation How To Display This Data Using Arrays Inside Blade?

    I am trying to avoid loop in the query.

    https://ibb.co/gDf8yxF

    SELECT 
        modules.id AS module_id,
        modules.title AS module_title,
        lessons.title AS lesson_title,
        lessons.id AS lesson_id 
    FROM modules 
         LEFT JOIN lessons 
            ON lessons.module_id = modules.id
         WHERE modules.course_id = 9
    
    CREATE TABLE `lessons` (
      `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
      `user_id` int(11) NOT NULL,
      `module_id` int(11) NOT NULL,
      `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
      `sort` int(11) NOT NULL,
      `release_after` int(11) NOT NULL DEFAULT '0',
      `description` text COLLATE utf8mb4_unicode_ci,
      `created_at` timestamp NULL DEFAULT NULL,
      `updated_at` timestamp NULL DEFAULT NULL,
      `video_link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=704 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    
    CREATE TABLE `modules` (
      `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
      `user_id` int(11) NOT NULL,
      `course_id` int(11) NOT NULL,
      `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
      `sort` int(11) NOT NULL,
      `release_after` int(11) NOT NULL DEFAULT '0',
      `active` int(11) NOT NULL DEFAULT '1',
      `description` text COLLATE utf8mb4_unicode_ci,
      `created_at` timestamp NULL DEFAULT NULL,
      `updated_at` timestamp NULL DEFAULT NULL,
      `length` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    

    behnampmdg3 left a reply on Issue With Summernote

    @NAKOV - Not sure how to apply it to my code. It's ASP

    behnampmdg3 started a new conversation Issue With Summernote

    Documentation says https://summernote.org/deep-dive/#pastehtml :

    // @param {String} HTML string
    var HTMLstring = '<div><p>Hello, world</p><p>Summernote can insert HTML string</p></div>';
    $('#summernote').summernote('insertText', HTMLstring);
    
    

    But when I do this:

    $('.lesson_description').summernote('reset');
    var HTMLstring = $('#'+id+'_description').html();
    $('.lesson_description').summernote('insertText', HTMLstring);
    

    The editor is filled with this:

    &lt;u&gt;Some&lt;/u&gt; &lt;b&gt;text &lt;/b&gt;goes &lt;span style="background-color: rgb(206, 0, 0);"&gt;here&lt;/span&gt;&lt;br&gt;
    

    How can I get the editor to show the formatted text?

    Thanks