tisuchi

Developer at EDV Standard

Hire Me

Experience

139,965

58 Best Reply Awards

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

27th March, 2017

tisuchi left a reply on OrderBy Not Working With WhereIn • 3 seconds ago

Ohhh yes... I totally forgot that issue. @Snapey

I already changed, but still same!!!

tisuchi left a reply on OrderBy Not Working With WhereIn • 19 minutes ago

@jimmck

Its brining the result but not in desc order.

tisuchi left a reply on OrderBy Not Working With WhereIn • 1 hour ago

Any hope so far?

tisuchi left a reply on Wordpress Themes On Laravel 5.4 CMS • 1 hour ago

I think you need to clone the whole wordpress concept in paste into your laravel CMS that you are working for!!!

25th March, 2017

tisuchi left a reply on Permissions In Ubuntu • 2 days ago

Well, you may change to whole folder permission before installation.

I don't think so there is any other way to do so. I can refer you laravel document here- https://laravel.com/docs/5.4#configuration

tisuchi left a reply on Display Image • 2 days ago

If everything is ok, may be you can change a bit in your config/app.php.

From

'url' => env('APP_URL', 'http://localhost'),

Change to

'url' => env('APP_URL', 'http://localhost:8000'),

Now, try this again...

 <img src="{{url('/') }}/storage/uploads/{{ $user->image }}" >

tisuchi left a reply on Permissions In Ubuntu • 2 days ago

Personally I prefer you to change permission after every install. Its because of most folders should be normal "755" and files, "644"

Laravel requires some folders to be writable for the web server user.

However, you may find your answer here.. http://askubuntu.com/questions/20105/why-shouldnt-var-www-have-chmod-777

tisuchi left a reply on Display Image • 2 days ago

You may manually check whether you have photo in that folder or not?

www.yourdomainname.com/storage/uploads/put-your-photo-name-from-db

tisuchi left a reply on Display Image • 2 days ago

May be you can try simply that?

 <img src="{{url('/') }}/storage/uploads/{{ $user->image }}" >

24th March, 2017

tisuchi left a reply on Does GET Data Have Higher Priority Than POST Data In Laravel 5.4? • 2 days ago

Using either GET or POST has different purpose.

May be you can take a look this post... http://www.diffen.com/difference/GET-vs-POST-HTTP-Requests

tisuchi left a reply on Help Concatenate Varible • 2 days ago

You may follow @power comment, or simply use double quote (" ") instead of single code (' '). Hope it will work.

tisuchi left a reply on Laravel Dynamic Slider • 2 days ago

It's seems that, nothing wrong. Can you plz share your html sliding code that is working properly?

tisuchi left a reply on Laravel Dynamic Slider • 2 days ago

Can you show your code?

tisuchi left a reply on Mailing: API Based Driver Or SMTP? • 2 days ago

I personally prefer Mailgun. Its really nice.

Doesn't matter, its high or not. You can try any of these.

tisuchi left a reply on Where To Find All The Available Methods • 2 days ago

Ok, all the things you will get in laravel documents.

For Helpers: https://laravel.com/docs/5.4/helpers For Collections: https://laravel.com/docs/5.4/eloquent-collections

And finally checking the whole documentation https://laravel.com/docs/5.4

23rd March, 2017

tisuchi left a reply on Mailgun Laravel Error Authentication Required • 3 days ago

Which version of Laravel you are using?

tisuchi left a reply on Mailgun Laravel Error Authentication Required • 3 days ago

I can only see the different between you and my .env is MAIL_HOST.

I used this, working fine-

MAIL_HOST=smtp.mailgun.org

tisuchi left a reply on Mailgun Laravel Error Authentication Required • 4 days ago

Have you tried like so-

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=
MAIL_ENCRYPTION=null

MAILGUN_DOMAIN=yourdomain.com
MAILGUN_SECRET=your-mailgun-secret-key

tisuchi left a reply on Eloquent Vs Repositories • 4 days ago

No worries.... all the best @dinhtungtp

22nd March, 2017

tisuchi left a reply on Where Query In Search Filter • 4 days ago

Have you tried? It should work. More simplified way-


$employees = DB::table('employees');
 

// this condition will check whether name iput is empty or not. if it is not empty, only that time, it will 
// add the search query in $employees variable. The same way, you can add more
if (!empty($request->input('name')))
    $employees->where('name', 'LIKE', "%$request->input('name')%");

// lets check SubSectorID
if (!empty($request->input('SubSectorID')))
    $employees->where('SubSectorID', '=', $request->sub_sector);


// at the end, it will merge all the query and execute 
$result = $employees->get();

tisuchi left a reply on Eloquent Vs Repositories • 4 days ago

tisuchi left a reply on Where Query In Search Filter • 4 days ago

Haha... Ok. In that case, you can try with laravel condition based query.

For example-

$queryBodyType = DB::table('profiles');
 
if (!empty($fieldOne))
    $queryBodyType->orWhere('bodytype', 'LIKE', "%$fieldOne%");
 
if (!empty($fieldTwo))
    $queryBodyType->orWhere('bodytype', 'LIKE', "%$fieldTwo%");
 
 
$result = $queryBodyType->get();

tisuchi left a reply on Where Query In Search Filter • 4 days ago

If it is only one filed, than you can apply simply if-else condition-

if(!empty($request->has('name'))){
    $employees=employee::where([
        ['name','like','%'.$request->name.'%'],
        ['MainSectorID','=',$request->main_sector],
        ['SubSectorID','=',$request->sub_sector],
        ['Email','=',$request->email],
        ['MilitaryStatus','=',$request->MilitaryStatus],
        ['EmployeeStatus','=',$request->EmployeeStatus],
        ['Gender','=',$request->Gender]
        ])
      ->get();
} else {
    $employees=employee::where([
        ['MainSectorID','=',$request->main_sector],
        ['SubSectorID','=',$request->sub_sector],
        ['Email','=',$request->email],
        ['MilitaryStatus','=',$request->MilitaryStatus],
        ['EmployeeStatus','=',$request->EmployeeStatus],
        ['Gender','=',$request->Gender]
        ])
      ->get();
}

tisuchi left a reply on Route Name Not Working • 4 days ago

Nice....

Its working so good for me. Unfortunately you are getting error... :(

tisuchi left a reply on Route Name Not Working • 4 days ago

Again, personally I prefer the style that you used before-

Route::get('/activate/token/{token}', [
    'as' => 'auth.activate',
    'uses' => 'Auth\[email protected]',
]);

If it is working fine to you, keep using that. Thats cool, isn't that?

tisuchi left a reply on Route Name Not Working • 4 days ago

What laravel version you are using?

The ->name('routeName'); has been supporting since version 5.1

tisuchi left a reply on Route Doesn't Work Properly • 4 days ago

Its nothing wrong. Working fine to me.

Since not working in your side, I gave you another option to call that.

Ref: https://laravel.com/docs/5.4/routing#named-routes

tisuchi left a reply on Route Doesn't Work Properly • 4 days ago

Beside @jlrdw comment, you may try this one also-

Route::get('about', [
    'uses'  => [email protected]',
    'as'        => 'about'
]); 

Now in blade-

href="{{ route('about') }}"

tisuchi left a reply on Selecting Data And Passing To Controller In Laravel • 4 days ago

You may try with @Abi suggestion first.

Beside that, here is the skelton of ajax post. You may recheck that-

$.ajax({  
    type: 'POST',  
    url: "{{ route('Your-Route-Name') }}", 
    data: { data: variableData, data2: variableData2, _token: token},
    success: function(response) {
  
    }
});

*** Don't forget to pass csrf_token as suggested in previous comment.

tisuchi left a reply on OrderBy Not Working With WhereIn • 4 days ago

Well, without groupBy, its working fine.

tisuchi left a reply on Selecting Data And Passing To Controller In Laravel • 4 days ago

What you want to do?

tisuchi left a reply on OrderBy Not Working With WhereIn • 4 days ago

Event try that, not working with hardcoding data in whereIn() .

tisuchi left a reply on OrderBy Not Working With WhereIn • 4 days ago

Of course, its return array with values-

array:8 [▼
  0 => 185
  1 => 187
  2 => 188
  3 => 189
  4 => 190
  5 => 191
  6 => 192
  7 => 193
]

tisuchi left a reply on OrderBy Not Working With WhereIn • 5 days ago

its neither ascending nor descending

tisuchi left a reply on OrderBy Not Working With WhereIn • 5 days ago

@divanoli

There is no error, but the result is not showing perfectly.

Thank you for your answer. Yes, I am passing array in whereIn() properly.

Yes, I tried with dd() that return the result, once again, not in proper order.

21st March, 2017

tisuchi left a reply on OrderBy Not Working With WhereIn • 5 days ago

Thanks @vipin93

I tried as follows-

orderBy()
sortBy()
sortByDesc()
latest()

tisuchi left a reply on OrderBy Not Working With WhereIn • 5 days ago

Its because of whereIn(), without that, its working perfectly....

tisuchi left a reply on OrderBy Not Working With WhereIn • 5 days ago

yes... I tried. But none of the things is working.

tisuchi left a reply on Laravel | How To Get Count Of Items In A Grouped Collection • 5 days ago

May be you can try this-

$getData = DB::table('tablename')
                 ->select('account_id', DB::raw('count(*) as total'))
                 ->groupBy('account_id')
                 ->get();

tisuchi started a new conversation OrderBy Not Working With WhereIn • 5 days ago

Trying to use whereIn and OrderBy together, however, not working.

Any tip?

$conversationIds = Conversation::where('user_one', Auth::user()->id)
                                ->orWhere('user_two', Auth::user()->id)
                                ->lists('id')
                                ->toArray();


$conversations = Message::whereIn('conversation_id', $conversationIds)
                                ->orderBy('id', 'desc')
                                ->groupBy('conversation_id')
                                ->get();

17th March, 2017

tisuchi left a reply on Two Auth Types (Users And Admins With Different Model) • 1 week ago

May be you can set user's role. For instance-

1 is For Normal User 2 for For Admin User

After login each user, you will show the page based on their user role. If logged in user role is 1, just display normal user dashboard, otherwise admin.

You may get lot of tutorial about that. Just recommend this for understanding the concept-

https://www.thesoftwareguy.in/creating-multi-user-role-based-admin-using-php-mysql-bootstrap/

tisuchi left a reply on Model Count With A Condition As Per The Auth::user()->name • 1 week ago

@kailash95

No worries. Welcome to Laravel world. :)

tisuchi left a reply on Model Count With A Condition As Per The Auth::user()->name • 1 week ago

Use auth after namespace.

<?php

namespace App\Http\Controllers;

tisuchi left a reply on Model Count With A Condition As Per The Auth::user()->name • 1 week ago

@kailash95

I believe, you are nearly there. Just use following code-

public function store(Request $request) { 
    sms::create(Request::all()); 
    $count = sms::where("sms_from" ,Auth::user()->name)->count(); 
    return $count; 
}

Ref: https://laravel.com/docs/5.4/queries#retrieving-results

tisuchi left a reply on My Page Is Registering Without Google Recaptcha .How To Validate It Can Anyone Please Tell Me? • 1 week ago

@jhansi...

The code I provide you in above, its working fine for me.

You guy double check that, you wrote everything properly.

tisuchi left a reply on Error Messages And Auth In L5.3 • 1 week ago

Have you tried with custom validation? https://laravel.com/docs/5.4/validation

16th March, 2017

tisuchi left a reply on Submit Form Data After A Redirect To Login • 1 week ago

I believe, session is the one of the best solution for you.

To track a visitor by unique session, you can just follow this steps-

http://www.larademy.com/laravel/laravel-tracking-visitors-by-a-unique-session/

tisuchi left a reply on Populating A <select> Tag With The Next 6 Months Using Carbon • 1 week ago

Just change bit in your controller.

Can try this-

public function planner()
{
    $dt = Carbon::now();
    $currentMonth = $dt->month;

    //getting next 6 months from now
    $months = [];
    for($i = $currentMonth; $i < $currentMonth + 6; $i++){
        array_push($months, $i);
    }

    $page = Page::where('title', 'Planner')->first();

    return view('planner', compact('page', 'months'));
}


tisuchi left a reply on My Page Is Registering Without Google Recaptcha .How To Validate It Can Anyone Please Tell Me? • 1 week ago

Would you mind to reshape your code a bit?

Here is the code that you can check recaptcha without using any plugin.

In you view-

<div class="g-recaptcha" data-sitekey="your-site-key-will-be-here"></div>
      <input type="hidden" id="terms" name="terms" value="1">
      <input type="hidden" id="referral" name="referral" value="">
</li>

Now, finally in your controller, you need to check it like so-


//recaptcha will generate a textarea name g-recaptcha-response
$captcha = $request->input('g-recaptcha-response');
        

if(empty($captcha)){
   return redirect()
            ->back()
            ->withErrors('Please make sure to select the captcha box before submitting your information')
            ->withInput();
}else{
   $response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=Put_your_key_here&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true);
   if($response['success'] == false)
    {
        return redirect()
                ->back()
                ->withErrors('reCaptcha Error! Please try again.')
                ->withInput();;
    }
    else
    {
        $flag = 0;
    } 
}  

Ref: https://developers.google.com/recaptcha/intro

Edit Your Profile
Update

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