tuytoosh

tuytoosh

PHP web application developer at Iran

Iran

Hire Me

Member Since 3 Years Ago

Experience Points 7,245
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 6
Best Answer
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.

11 Oct
2 months ago

tuytoosh started a new conversation Build Existing Components Vuejs

Hi, I am working on an existing project and I my customer said that we need to add features to it, I am very newble in vuejs and there is a small change in vue component. there was not any package.json file in project and I have not access to main programmer. how I can build component to main app.js file?

17 Apr
7 months ago

tuytoosh left a reply on Passport Redirecting For Authorization Redirects To Login Route

@bobbybouwmann The problem is with oauth/authorize route... when I enter this route manually in address bar, it redirects me to login route again!

16 Apr
7 months ago

tuytoosh left a reply on Passport Redirecting For Authorization Redirects To Login Route

@bobbybouwmann I changed redirect_uri to example.com but still I have same problem...

15 Apr
7 months ago

tuytoosh left a reply on Passport Redirecting For Authorization Redirects To Login Route

@bobbybouwmann Thank you for answer, This is my route for redirecting for authorization and it returns me to login route :(

Route::get('/redirect', function () {
    $query = http_build_query([
        'client_id' => '1',
        'redirect_uri' => 'http://127.0.0.1:8000/something_else',
        'response_type' => 'code',
        'scope' => '',
    ]);

    return redirect('http://127.0.0.1:8000/oauth/authorize?'.$query);
});
08 Apr
8 months ago

tuytoosh started a new conversation Passport Redirecting For Authorization Redirects To Login Route

Hi all, I want to use Passport for API authentication and I am going with [laravel passport documentation](laravel passport documentation), in requesting tokens, we need to redirect client to app for authorization, when I send get request for redirect, laravel redirects me to login route...

why?

20 Apr
1 year ago

tuytoosh started a new conversation Send SMS Notification

Hi all, I want to send sms notification in my laravel app, but I want to use another sms delivery provider in my country and it`s notification channel is not provided in laravel notification channels website...

how I can send sms notification without common sms channels?

09 Apr
1 year ago

tuytoosh left a reply on Laravel 5.4 Csrf Token Mismatch

check your /storage/framework/sessions folder to be writable...

tuytoosh started a new conversation Get All Posts That Has Not Specific Tag

Hi, a simple question!

I have a posts table with a many to many relation to tags table. I want to get all posts that has not a specific tag, for example all tags except tag by id 41...

how to do this?

15 Jan
1 year ago
14 Jan
1 year ago

tuytoosh left a reply on Save UTF-8 Ecoded String In MySQL Database

@jekinney Yes, and I need to validate user input and return them error or...

and why mb_detect_encoding() function returns UTF-8?

tuytoosh started a new conversation Save UTF-8 Ecoded String In Database

Hi all, I want to save a text like this : "-CHILIK CHILIK BNG BNG????????????????" in database in laravel and mysql, and I have this error : is error : `SQLSTATE[HY000]: General error: 1366 Incorrect string valu

I checked string encoding by php mb_detect_encoding() function and it returned me UTF-8, my MySQL table collation is utf8_unicode_ci and I have not problem until now by that...

Also I tried mb_convert_encoding() to convert encoding to UTF-8 and again I have that issue...

Where is the problem and how to fix it? thanks.

20 Dec
1 year ago

tuytoosh started a new conversation Get Users That Has A Permission And Send Them Notification

Hi , I want to get all users(in entrust) that has a permission and send them notification. something like this : User::can('reply_tickets')->all();

07 Dec
2 years ago

tuytoosh left a reply on How To Get Laravel Work At Home. I Am Expert In Laravel And Angular Js.

I think that freelance is very better than working in company... (maybe just in Iran, that I live in...)

I worked more than 1 year in a company in Iran(Zanjan) and now I left it because I have not any portfolio for my own and all projects is for the company...

I am now working with freelance websites like https://www.freelancer.com...

tuytoosh left a reply on Laravel 5.3 Can't Login With Auth::attempt

I have exactly this problem... I am working with ampps and ubuntu 16 and my storage folder is writable... where is the problem?

my Session::flash and attempt and... is not working and it seems that sessions not stored...

22 Nov
2 years ago

tuytoosh left a reply on Middleware Redirect

Edit AuthMiddleware as I say above...

21 Nov
2 years ago

tuytoosh left a reply on Middleware Redirect

An idea can be this : mix auth and new_user middleware and say if user logged in and last_login = null redirect to reset pass route...

tuytoosh left a reply on Middleware Redirect

auth middleware redirects to a place and new_user redirects to another place and it is loop :)

tuytoosh left a reply on SQLSTATE[HY000]: General Error: 1366 Incorrect String Value

@Snapey

I get content of body with file_get_content() method and sometimes it is OK...

How can exist that you say?

tuytoosh started a new conversation SQLSTATE[HY000]: General Error: 1366 Incorrect String Value

Hi all, I am crawling a website with file_get_content() and now I want to save its content in a text field in database... sometimes it is good and my data saves as I want...

but some bad times... this error is occurred:

QueryException in Connection.php line 769:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xD9\x86\xD8\xB4 \xD8...' for column 'body' at row 1 (SQL: update `addresses` set `body` = 'a big content :)' `updated_at` = ? where `id` = ?)

How I can fix it and store data? Thanks

tuytoosh started a new conversation [PDOException] Could Not Find Driver

Hi all, I am using ubuntu with ampps , and now I want to install laravel...

When I want to run php artisan migrate in terminal in root, I have this error :

[PDOException]         
  could not find driver

My pdo_mysql.so extension in ampps control panel is enabled... :(

Help me please :(

16 May
2 years ago

tuytoosh left a reply on Keep Logged In In Subdomains

I am waiting for answer :(

tuytoosh started a new conversation Keep Logged In In Subdomains

Hi all , I am working on a project that has many subdomains... I want to user be logged in , in others subdomains... how I can do this?

My OS : windows 10 and I am working on wamp with php 5.6.16

thanks

10 Jan
2 years ago
09 Jan
2 years ago

tuytoosh left a reply on Question About Composer

For autoload your classes in the all php files, the easiest way is using composer autoloading system. Imagine that you have 10 class and you need them in one other class , composer prevents you from using require command and your classes loads every time that you need them automatically...

08 Jan
2 years ago

tuytoosh left a reply on How To Filter This Relation?

@jlmmns

I can not find any reason and justification for second SQL query...

I prefer to ignore :)))

tuytoosh left a reply on How To Filter This Relation?

@jlmmns Yes , that is the second way... But the first way is not bad too : "An account is belong to a user as owner..."

tuytoosh left a reply on How To Filter This Relation?

@jlmmns sorry! Use this :

public function owner()
{
    return $this->belongsTo('App\User' , 'owner_id'); 
}

tuytoosh left a reply on Admin And User Different Views

I am agree with @Elimentz .

if your project will be big in future , use this package for manage your roles and permissions : https://github.com/Zizaco/entrust

tuytoosh left a reply on How To Filter This Relation?

Use an one to one relationship... add one field like owner_id in your accounts table and use this function in your Account model :

public function owner()
{
    return $this->hasOne('App\User' , 'owner_id'); 
}

now you can use this : $accountOwner = $account->owner;

07 Jan
2 years ago

tuytoosh left a reply on Building High Traffic, Heavy Search Based Website

I think that elastic is good for low data inserting and it is good for example for search engine with complex text searching... not for a portal that has many data inserting and...

now I have a website( with 2k online users ) that created by laravel 5 and MySQL and is not there any problem...

and I think that a noSQL storage like mongoDB is a new and good technology for your work

tuytoosh started a new conversation Disable Laravel5 Logging

Hi , my laravel 5 app is working in a shared host with 20GB disk space

but now I have about 13GB log file... :)

how I can disable logging in laravel 5 ?

06 Jan
2 years ago

tuytoosh left a reply on Cotation In Eloquent Where Function

laracasts says that we have 4 reply... but now I have just 2 reply...

why?

tuytoosh left a reply on Cotation In Eloquent Where Function

@psaunders thanks and sorry , I do not understand you... how I can fix that to works in all hosts?

tuytoosh started a new conversation Cotation In Eloquent

Hi , I am using mySQL in for my laravel web app... for get all categories that has parent 0 , I use this code : $fathers = App\Cat::all()->where('parent' , 0); in some shared host it works and gives me all parent 0. but in some others it gives me empty output and this works good : $fathers = App\Cat::all()->where('parent' , '0');

why it is so... and how can fix that to work in all hosts?

23 Nov
3 years ago

tuytoosh left a reply on Read A .txt File In Laravel 5 :(

@zachleigh Thanks for answer.

Now I have this error : File does not exist at path last.txt

tuytoosh started a new conversation Read A .txt File In Laravel 5 :(

Hi , I have a .txt file like last.txt in my project root. I am using following code for show the content of file :

$contents = File::get(url('last.txt'));
        dd($contents);

but I have this error : File does not exist at path http://didany.net/last.txt where is the problem?

12 Nov
3 years ago

tuytoosh started a new conversation Laravel Not Gets Payment Gateway Parameters That Returned

Hi all, I want to use an Iranian payment gateway(Payline) in my laravel-5 project. Payline sends final information to me with this form :

<form action="http://instak.ir/res" method="post" name="frm1">
    <input name="trans_id" id="trans_id" type="hidden" value="389051"  />
    <input name="id_get" id="id_get" type="hidden" value="91234"  />
    <input name="btn3" id="btn3" type="submit" class="btn" value=" بازگشت به سایت مبدا "/>
  </form>

I have a route like this for grab info from Payline: Route::post('res' , 'HomeController@result');

And this is my result() method :

public function result()
    {
        $url = $this->second_url;
        $api = $this->api;
        $trans_id = $_POST['trans_id'];
        $id_get = $_POST['id_get'];
        $result = $this->get($url,$api,$trans_id,$id_get);
        if($result == 1)
        {
            $buy = App\Buy::where('id_get' , $id_get)->first();
            $buy->status = 1;
            $buy->trans_id = $trans_id;
            $buy->save();
            return Redirect('user/pages/info/'.$buy->id)
                ->with('Msg' , 'successful!');
        }
        else
        {
            return Redirect::to('/user/pages')
                ->with('Msg' , $this->finalSayError($result));
        }
    }

When I define my route as post this error occurred : Controller method not found.. and when I define it as get I have this error : Undefined index: trans_id...

where is the problem?

06 Nov
3 years ago

tuytoosh left a reply on Laravel Save Method Not Saving Data Completely

I find my problem reason... sometimes I have a character like � in my body that laravel not saves the characters after it... I find to use this line to delete � character...

$post->body = mb_convert_encoding($this->render($post), 'UTF-8', 'UTF-8');

05 Nov
3 years ago

tuytoosh left a reply on Laravel Save Method Not Saving Data Completely

@thomaskim yes, I tried both and now is longtext...

tuytoosh started a new conversation Laravel Save Method Not Saving Data Completely

I am using Laravel to create a web bot that collects data from other websites and stores it in my MySQL database. When I want to save body I use dd($this->render($post)); and it is good. Yet, when I use $post->save() for saving my post in db, it not saving the body of my post completely and some of text is missing.

My body is at least 10000 characters and I always have this problem.

I checked text and longtext for body column type and is not there any difference...

Where is problem?

edit :

this is my index method :

 public function getIndex()
    {
        $temp = App\Temp::where('status' , 0)->orderBy('id' , 'desc')->first();
        $temp->status = 1;
        $temp->save();
        $post = new App\Post;
        $post->title = $temp->title;
        $post->link = $temp->link;
        $post->desc = $temp->desc;
        $post->cat_id = $temp->cat_id;
        $post->url_id = $temp->url_id;
        $post->body = $this->render($post);
        $post->save();
        echo "+";
    }

When I am using dd($this->render($post)); before save, it shows full text without any problem... but after save when I fetch the body, some characters is missing from the end of post...

and this is render() method...

public function render($post)
    {
        echo "Start : ";
        $this->ftp->createFolder('/'.$post->url_id.'/'.$post->id."/");
        echo "Dir - ";
        $mixed_body = $this->desc($post->title);
        echo "Mix - ";
        $body ="";
        $body = $body . '<h3><a href='.$this->postUrl.'>'.$this->postTitle.'</a></h3>';
        echo "Title - ";

        while(strlen($mixed_body) > 100)
        {
            $body = $body . $this->randImage($post);
            $body = $body . $this->randTitle();

            //insert a random paragraph
            $number = rand(100 , strlen($mixed_body));//temporary
            $paragraph = substr($mixed_body , 0 , $number);
            $mixed_body = substr($mixed_body , $number , strlen($mixed_body)-$number);

            $body = $body . '<p>' . $paragraph . '</p>';
            echo "P|";
        }
        echo "\nDone : ".strlen($body);
        return $body;
    }

others methods in render() are appending some text to $body and those are not important.

and my model :

<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model {

    public function tags()
    {
        return $this->hasMany('App\Tag');
    }

}
23 Oct
3 years ago

tuytoosh started a new conversation Run A Method Of Controller With Cron And Scheduling Closures

this is working : ... protected function schedule(Schedule $schedule) { $schedule->command('inspire') ->hourly();

    $schedule->call(function()
    {
        $post = new App\Post;
        $post->title = 'with cron';
        $post->img = 'with cron';
        $post->desc = 'with cron';

        $post->save();
    })->cron('* * * * *');
}

...

but this is not working :

protected function schedule(Schedule $schedule)
    {
        $schedule->command('inspire')
                 ->hourly();

        $schedule->call(function()
        {
            $publish = new App\Http\Controllers\CronController;
            $publish->getPublish();
        })->cron('* * * * *');
    }

why?

11 Jun
3 years ago

tuytoosh started a new conversation Laravel 5 Package

Hi all, I have a new package that i create it with using this tutorial : http://www.codeanchor.net/blog/creating-custom-laravel-5-packages

and i upload it to github for test. but when I try to require it with this command : https://github.com/tuytoosh/simple-admin composer require tuytoosh/simple-admin I have this error :

 [InvalidArgumentException]
 Could not find package tuytoosh/simple-admin at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
24 May
3 years ago

tuytoosh left a reply on Facade Is Not Working

and how to autoload my class?

:(

tuytoosh left a reply on Facade Is Not Working

@bashy says that my facade must be in this directory : vendor\laravel\framework\src\Illuminate\Support\Facades\Menu.php

and @RachidLaasri says it most be in another folder like : vendor\tuytoosh\Menu

which is true? or it is not important?