tisuchi

Developer at EDV Standard

Hire Me

Experience

147,755

70 Best Reply Awards

  • Member Since 2 Years Ago
  • 1000 Lessons Completed
  • 12 Favorites

22nd April, 2017

tisuchi left a reply on Class Config Does Not Exist In Laravel 5.4 • 3 days ago

No worries. If it is working perfectly, than make it answer, so that others can be beneficiary from this question.

21st April, 2017

tisuchi left a reply on How To Move Laravel 5.4 Application To Shared Hosting? • 4 days ago

Ok, there are few ways to go.

I prefer just change your application public folder a bit. Check this tutorial- https://www.youtube.com/watch?v=pBTvXKGvrAA

tisuchi left a reply on Class Config Does Not Exist In Laravel 5.4 • 4 days ago

I don't feel that it will be any problem. Just give a try.

tisuchi left a reply on Can Anyone Guide Me How To Display The Table With This Format In Laravel • 4 days ago

Yes, just follow the @samalapsy option. Beside that, update a bit there-

Put your loop inside <tbody> tag.

<tbody>
    @foreach($projects as $project)
        <tr>
            <td> {{ $project->dateColumn }} </td>
            <td> {{ $project->myWalletColumn }} </td>
            <td> {{ $project->codeColumn }} </td>
            <td> {{ $project->devSupportColumn }} </td>
            <td> {{ $project->numberColumn }} </td>
            <td> {{ $project->numberAgainColumn }} </td>
        </tr>
    @endforeach
    
  </tbody>

tisuchi left a reply on Class Config Does Not Exist In Laravel 5.4 • 4 days ago

You can try by downloading stable php unit version. PHPUnit 6.0 may be problem for you.

Download PHPUnit 5 and try.

20th April, 2017

tisuchi left a reply on Multiple MorphToMany ? • 5 days ago

Here is the concept of Polymorphic Relations.

Imagine that, the Post and Video models will both have a tags method that calls the morphToMany method on the base Eloquent class.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    /**
     * Get all of the tags for the post.
     */
    public function tags()
    {
        return $this->morphToMany('App\Tag', 'taggable');
    }
}

Next, on the Tag model, you should define a method for each of its related models. So, for this example, we will define a posts method and a videos method:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Tag extends Model
{
    /**
     * Get all of the posts that are assigned this tag.
     */
    public function posts()
    {
        return $this->morphedByMany('App\Post', 'taggable');
    }

    /**
     * Get all of the videos that are assigned this tag.
     */
    public function videos()
    {
        return $this->morphedByMany('App\Video', 'taggable');
    }
}

Ref: https://laravel.com/docs/5.4/eloquent-relationships#many-to-many-polymorphic-relations

tisuchi left a reply on How To Create Dynamic <li> In Jstree • 5 days ago

Can you show you tables structure?

tisuchi left a reply on Token Mismatch Mobile Device • 5 days ago

Since you added your domain in session domain, that last solution that I can suggest you to use laravel caffeine. https://github.com/GeneaLabs/laravel-caffeine

But before that, make sure that, your mobile browser didn't disabled the cookies.

tisuchi left a reply on Laravel Relation For Different User Types • 5 days ago

To make it simpler, I support @ohffs comments. Just make it if else, may be-

The easier way to do it might be to check and return a different relation :

public function orders() { if ($this->is_shop) { return $this->hasMany(Order::class, 'created_by'); } return $this->hasMany(Order::class, 'fulfilled_by'); }

tisuchi left a reply on Laravel Relation For Different User Types • 5 days ago

May be you can try with Polymorphic relationships. Imagine that, each order has been placed by either shop or Supplier.

Check More: https://laravel.com/docs/5.4/eloquent-relationships#polymorphic-relations

tisuchi left a reply on Compare The Records In Two Table For A Mactch • 5 days ago

If you need to check by laravel, you may be try with join-

$users = DB::table('cache_user')
            ->join('main_users', 'cache_users.id', '!=', 'main_users.user_id')
            ->select('main_users.*')
            ->get();

Now, in $users variable, you will get all the mismached record from main_users table.

Now you may write query to insert into cache_users from $users.

tisuchi left a reply on How To Get More Info On TokenMismatchException Log Entries? • 5 days ago

May be you can play with Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php file.

tisuchi left a reply on Move Existing Row To Another Table • 5 days ago

If it is simply moving row from one table to another (without any existing data), just go to database, add a new row in Old_searchterms and delete from Searchterms.

Don't forget to update your respective migration file.

tisuchi left a reply on Disable Verify Csrf Token By Middleware • 5 days ago

There are few way to solve this issue, may be. But I suggest to go- App\Http\Kernel.php

And comment this line from protected $middleware array.

                'App\Http\Middleware\VerifyCsrf',

Of course, there are few more way to go.

tisuchi left a reply on Throwing Error Undefine Namecategory • 5 days ago

Isn't that because of the space?

Try (Just remove the empty space in front of namecategory)

$result[ $u->namecategory ] 

Instead of

$result[ $u-> namecategory ] 

tisuchi left a reply on Laravel 5.1.46 Middleware Weird Behaviour • 5 days ago

I am not sure, may be instead of clear session, you may disable session for a particular route.

You may check the following discussion that might be very close to your issue- https://laracasts.com/discuss/channels/laravel/laravel-51-disable-session-and-cookies-for-some-routes

tisuchi left a reply on Get Id Of Inserted Row And Use For The Next Query? • 5 days ago

You can just simply call-

$booking->id;

This will give you last inserted ID of $booking.

19th April, 2017

tisuchi left a reply on Join Query And Sub Join Query • 1 week ago

It seems that, its fine. May be you try with leftJoin() instead of simply join().

Ref: https://laravel.com/docs/master/queries#joins

tisuchi left a reply on Join Query And Sub Join Query • 1 week ago

In controller, may be you need to add groupBy()-

$users = DB::table('mastercategory')
          ->join('subcategory', 'mastercategory.idcategory', '=', 'subcategory.idcategory_mastercategory')
          ->join('subling', 'subcategory.idsubcategory', '=', 'subling.idsubcategory_subcategory')
          ->select('mastercategory.*', 'subcategory.*','subling.*')
          ->groupBy('mastercategory.namecategory')
          ->get();

tisuchi left a reply on Laravel Blog App!! Create A Post But Not To Publish It!! • 1 week ago

Simply you may create an extra column in posts table called flag. It will contain either 0 or 1. May be you can save a new post in table, and by default the post flag is zero. It will be 1 (from default value 0) when you hit the publish button only.

And in front end, you need to add condition to display post

->where('flag', 1)

tisuchi left a reply on Join Query And Sub Join Query • 1 week ago

Show your view (blade) code.

17th April, 2017

tisuchi left a reply on Error On Public_html • 1 week ago

I am not sure whether you are trying to upload your project in shared hosting (cPanel) or not.

If you are trying to host in cPanel, you must need to change something either in index.php or .htaccess file because the structure of cPanel and Laravel are different.

So, you may be check this video for changing a bit in index.php file. https://www.youtube.com/watch?v=pBTvXKGvrAA

15th April, 2017

tisuchi left a reply on Save Multiple Row Of Data From One Form • 1 week ago

Can you elaborate more clearly what you want to do?

13th April, 2017

tisuchi left a reply on Laravel 5.4 Is Not Creating Csrf Cookie On My Hosting • 1 week ago

So far, its not issue with cookies. Its just rendering to html templates.

You may be check few things here-

  • Check in other browser
  • Check in other computer If everything is ok there, than, delete your browser history and run it again in your computer.

It should work than.

tisuchi left a reply on Laravel 5.4 Is Not Creating Csrf Cookie On My Hosting • 1 week ago

You need to ensure either 1 in your html source code.

<meta name="csrf-token" content="a8YwpsXSj6XZI2Re28NturuU3BlyG5YZVGf8042h">

OR

<input type="hidden" name="_token" value="a8YwpsXSj6XZI2Re28NturuU3BlyG5YZVGf8042h">

In html form as a hidden value.

Just go to your page, and check html source code that whether there is csrf token or not.

12th April, 2017

tisuchi left a reply on [Help] I Want To Try To Show You A Selection Of Products By Category • 1 week ago

** Better put your code here.

To solve your issue, you need to change bit in your code-

##In Web.php just pass the category name to controller

Route::get('/catalogs/{passCategoryName}', [email protected]');

Ref: https://laravel.com/docs/5.4/routing#route-parameters

##In FrontController, change your index file like follows-

public function index($catalogs)
{
    // pass a parameter example.com/catalogs/nameofcatalogs
    if(!empty($catalogs)) {
      $cat = $catalogs;
      $category = Category::where('categoryNameFromDatabase', $catalogs)->pluck('related_products_id')->toArray();
      $products = Product::whereIn('id', $category)->paginate(4);
    } else {
      $products = Product::paginate(4);
      $category = Category::all();
    }
    return view('front.index', compact('products','cat','category'));
}

Make sure in your blade that none to the variable is empty before printed it out.

Hope it will work.

tisuchi left a reply on Laravel 5.3 How To Get The Total Number Of Customers Who Have Only Two Orders • 1 week ago

I did a mistake here, it should be-

$q->select(DB::raw('count(*) as total'));

and make sure on top of the class, you use

use DB;

tisuchi left a reply on Data Model With Different Parameters • 1 week ago

It should work. Give a try...

tisuchi left a reply on Laravel 5.3 How To Get The Total Number Of Customers Who Have Only Two Orders • 1 week ago

You may give a try this. May be it will work-

$getAllOrders = Order::whereHas('customer', function($q) {
    $q->select(DB::raw('count(*) as total');
    $q->groupBy('customers_id');
    $q->where('total', '>', 2);
})->get();

tisuchi started a new conversation Duplication Notification • 1 week ago

Recently someone mentioned about me once. In my notification bar, it suppose to display once. However, it shows 4 times. I feel its a bug. @JeffreyWay may be take a look...

http://imgur.com/a/EPmLR

11th April, 2017

tisuchi left a reply on Automatic Key Detection Not Working Properly In Model Relationships • 2 weeks ago

I am so sorry so say that, the following line I found in Laravel documentation.

Remember, Eloquent will automatically determine the proper foreign key column on the Comment model. By convention, Eloquent will take the "snake case" name of the owning model and suffix it with _id. So, for this example, Eloquent will assume the foreign key on the Comment model is post_id

Source: https://laravel.com/docs/5.4/eloquent-relationships#one-to-many

So, in this case, your model name is Asana and add snake case suffix with _id is equal asana_id. That's what we follow....

tisuchi left a reply on DB::select Not Preserving Order • 2 weeks ago

Can you show your laravel query?

tisuchi left a reply on How Would You Model This Relationships? • 2 weeks ago

If I get you properly, I prefer you to follow HasManyThrough relationships.

https://laravel.com/docs/5.4/eloquent-relationships#has-many-through

tisuchi left a reply on Automatic Key Detection Not Working Properly In Model Relationships • 2 weeks ago

Automatically not detecting because, laravel expectation and your filed name are not same.

For example- In following code, laravel expect foreign key as asana_id but your's is asana_level_id. For that reason, you need to provide foreign key additionally.

public function asanas() { 
    return $this->hasMany('App\Asana', 'asana_level_id');
} 

tisuchi left a reply on Login • 2 weeks ago

Show code...

tisuchi left a reply on How To Make A Laracasts Type Video Tutorial • 2 weeks ago

Beside others comments, may be I can suggest you a Screencast series by Jeffrey way. You may take a look - https://photography.tutsplus.com/courses/pro-screencasting-for-the-rest-of-us

tisuchi left a reply on Bluehost For Laravel 5.4? • 2 weeks ago

Of course it will work. But personally I have lot of bad experience with Bluehost hosting. I may suggest you to go some other equivalent companies. If host in shared hosting, you may follow this video- http://www.tisuchi.com/upload-laravel-projecy-cpanel/

tisuchi left a reply on Carbon Date Diff Without Weekends • 2 weeks ago

May be you can use a custom function in Laravel. Here is the function that can help you-

https://gist.github.com/quawn/8503445

tisuchi left a reply on Data Model With Different Parameters • 2 weeks ago

May be you can use when() or if() in query builder.

$results = DB::table('items')
    ->where('id', '>', 0)
    ->if($filtersArray['forum_id'], 'forum_id', '=', $filtersArray['forum_id'])
    ->if($filtersArray['forum_status'], 'status', '=', $filtersArray['forum_status'])
    ->get();

Ref: http://themsaid.com/laravel-query-conditions-20160425/

tisuchi left a reply on Real-estate Style Search Forms, Return Query, Add Searched Parameters To URI • 2 weeks ago

It might not be the best idea. However, you may follow this in your route...

Route::group(['prefix' => 'listings/main'], function (){

    Route::get('mls-{listId}', function(){
        Route::get('type-{houseType}', function(){
            Route::get('city-{houseType}', [
                'uses'  => [email protected]',
                'as'    => 'showsearch'         
            ]);     
        });     
    });

});

tisuchi left a reply on Find Or Fail - Strange Behaviour • 2 weeks ago

Well, there is a bit difference between findOrFail() and firstOrFail()

Normally findOrFail() check the field named id in a table. That is why you may get the wrong data.

You may still use findOrFail() but may be overwrite your function a bit. Just check this conversation- https://laracasts.com/discuss/channels/general-discussion/findorfail?page=2

tisuchi left a reply on Trying To Get Property Of Non-object • 2 weeks ago

Make sure that, you are passing an object called $post in single.blade.php page and that object has a property called id.

The only reason I can see here for error is -

{{ Form::open(['route' => ['comments.store', $post->id], 'method' => 'POST']) }} 

Make sure that, $post->id doesn't generate any error.

tisuchi left a reply on Call To Undefined Method Wehere() • 2 weeks ago

It should be where() instead of wehere().

Just change a bit-

 public function hasRole($role) 
    {
        //dd($role);  i have the value admin

        if($this->roles()->where('name', $role)->first()) {   // i'm getting error here
            return true;
        }
        else {
            return false;
        }
    }

tisuchi left a reply on BadMethodCallException In Validator.php Line 1067: Method [getMessages] Does Not Exist. • 2 weeks ago

Then simply return like that way-

if ($validator->fails()) {
            return response()->json($validator->messages(), 200);
        }

tisuchi left a reply on BadMethodCallException In Validator.php Line 1067: Method [getMessages] Does Not Exist. • 2 weeks ago

I checked your code for validation, however, its working perfectly for me. Here is the code that working fine-

$validator = Validator::make($request->all(), [
            'title' => 'required|max:191',
            'name' => 'required|max:191',
            'middle_names' => 'max:191',
            'surname' => 'required|max:191',
            'dob' => 'required|date',
            'gender' => 'required',
            'email' => 'required|email|unique:users|max:191',
        ]);

        if ($validator->fails()) {
            return redirect()
                ->back()
                ->withErrors($validator)
                ->withInput();
        }

You may execute this code and check.

tisuchi left a reply on Uploading My Website On Dedicated Server • 2 weeks ago

There are few ways to do that-

-1. Using .htaccess -2. Changing folder path.

I personally use option two. For my reference, I created a video. You may take a look into it- http://www.tisuchi.com/upload-laravel-projecy-cpanel/

tisuchi left a reply on BadMethodCallException In Validator.php Line 1067: Method [getMessages] Does Not Exist. • 2 weeks ago

Where is getMessages() method?

tisuchi left a reply on Automatic Key Detection Not Working Properly In Model Relationships • 2 weeks ago

If your foreign key is not same, you may additionally add foreign key.

public function asanas() { 
    return $this->hasMany('App\Asana', 'asana_level_id');
} 

for inverse-

public function level() { 
    return $this->belongsTo('App\AsanaLevel', 'level_id');
}

Ref: https://laravel.com/docs/5.4/eloquent-relationships#one-to-many

Edit Your Profile
Update

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