tuytoosh

PHP web application developer at Iran

Hire Me

Experience

7,195

6 Best Reply Awards

  • Member Since 3 Years Ago
  • 0 Lessons Completed
  • 0 Favorites

17th April, 2018

tuytoosh left a reply on Passport Redirecting For Authorization Redirects To Login Route • 3 months ago

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

16th April, 2018

tuytoosh left a reply on Passport Redirecting For Authorization Redirects To Login Route • 3 months ago

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

15th April, 2018

tuytoosh left a reply on Passport Redirecting For Authorization Redirects To Login Route • 3 months ago

@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);
});

8th April, 2018

tuytoosh started a new conversation Passport Redirecting For Authorization Redirects To Login Route • 3 months ago

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?

20th April, 2017

tuytoosh started a new conversation Send SMS Notification • 1 year ago

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?

9th April, 2017

tuytoosh left a reply on Laravel 5.4 Csrf Token Mismatch • 1 year ago

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

tuytoosh started a new conversation Get All Posts That Has Not Specific Tag • 1 year ago

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?

15th January, 2017

tuytoosh left a reply on Save UTF-8 Encoded String In MySQL Database • 1 year ago

I am waiting yet :(

14th January, 2017

tuytoosh left a reply on Save UTF-8 Ecoded String In MySQL Database • 1 year ago

@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 • 1 year ago

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.

20th December, 2016

tuytoosh started a new conversation Get Users That Has A Permission And Send Them Notification • 1 year ago

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();

7th December, 2016

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

@MalaniDerrick Wooow!!! my answer is the best answer :)))

Thanks, email : [email protected]

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

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 • 1 year ago

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...

22nd November, 2016

tuytoosh left a reply on Middleware Redirect • 1 year ago

Edit AuthMiddleware as I say above...

21st November, 2016

tuytoosh left a reply on Middleware Redirect • 1 year ago

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 • 1 year ago

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 • 1 year ago

@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 • 1 year ago

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 • 1 year ago

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 :(

16th May, 2016

tuytoosh left a reply on Keep Logged In In Subdomains • 2 years ago

I am waiting for answer :(

tuytoosh started a new conversation Keep Logged In In Subdomains • 2 years ago

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

10th January, 2016

tuytoosh left a reply on Show Different Menu Based On Role • 2 years ago

https://github.com/lavary/laravel-menu

This package maybe helps you...

9th January, 2016

tuytoosh left a reply on Question About Composer • 2 years ago

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...

8th January, 2016

tuytoosh left a reply on How To Filter This Relation? • 2 years ago

@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? • 2 years ago

@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? • 2 years ago

@jlmmns sorry! Use this :

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

tuytoosh left a reply on Admin And User Different Views • 2 years ago

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? • 2 years ago

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;

7th January, 2016

tuytoosh left a reply on Building High Traffic, Heavy Search Based Website • 2 years ago

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 left a reply on Session Store Not Set On Request. • 2 years ago

Change your File Permissions on Ubuntu

https://help.ubuntu.com/community/FilePermissions

tuytoosh started a new conversation Disable Laravel5 Logging • 2 years ago

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 ?

6th January, 2016

tuytoosh left a reply on Cotation In Eloquent Where Function • 2 years ago

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 • 2 years ago

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

tuytoosh left a reply on Where Are You All From? • 2 years ago

Iran <3

tuytoosh started a new conversation Cotation In Eloquent • 2 years ago

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?

23rd November, 2015

tuytoosh left a reply on Read A .txt File In Laravel 5 :( • 2 years ago

@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 :( • 2 years ago

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?

12th November, 2015

tuytoosh started a new conversation Laravel Not Gets Payment Gateway Parameters That Returned • 2 years ago

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?

6th November, 2015

tuytoosh left a reply on Laravel Save Method Not Saving Data Completely • 2 years ago

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');

5th November, 2015

tuytoosh left a reply on Laravel Save Method Not Saving Data Completely • 2 years ago

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

tuytoosh started a new conversation Laravel Save Method Not Saving Data Completely • 2 years ago

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');
    }

}

27th October, 2015

tuytoosh left a reply on Run A Method Of Controller With Cron And Scheduling Closures • 2 years ago

@Snapey where is laravel log file?

I don`t know about logging in laravel

23rd October, 2015

tuytoosh left a reply on Run A Method Of Controller With Cron And Scheduling Closures • 2 years ago

@Snapey it is not working yet :(

tuytoosh started a new conversation Run A Method Of Controller With Cron And Scheduling Closures • 2 years ago

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?

11th June, 2015

tuytoosh started a new conversation Laravel 5 Package • 3 years ago

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

24th May, 2015

tuytoosh left a reply on Facade Is Not Working • 3 years ago

and how to autoload my class?

:(

tuytoosh left a reply on Facade Is Not Working • 3 years ago

@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?

tuytoosh left a reply on Facade Is Not Working • 3 years ago

my namespace is vendor\tuytoosh\Menu

where i can add it for autoload?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.