tisuchi

Developer at EDV Standard

Hire Me

Experience

239,255

150 Best Reply Awards

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

22nd October, 2017

tisuchi left a reply on Email Not Sended With Namecheap • 6 hours ago

I see, here is the problem.

The tutorial you are following is not based on laravel 5.4. It may be in laravel 5.2

So, the structure of email in laravel 5.2 and 5.4 are different. So that, it might not trigger email.

So, just follow this documentation, that is straight forward for you to implement. https://laravel.com/docs/5.4/mail

tisuchi left a reply on Email Not Sended With Namecheap • 7 hours ago

I see.. Since you are using laravel auth, I suggest you to create a simple email and trigger to you. Than you will know whether its problem in your code, or in api side.

tisuchi left a reply on Email Not Sended With Namecheap • 7 hours ago

Which version of laravel you are using?

Can you show your email sending code?

tisuchi left a reply on How To Redirect My Subtask Form To Task Show File In Laravel 5.2 • 7 hours ago

Both are same types of work. I just give you one example. Imagine that, you have to redirect to http://localhost:8000/projects/1/task/6/subtask after adding a record.

public function store(Request $request,$projectId,$taskId)
{
    $subtask = new Subtask;
    $subtask->subtask_name = $request->input('task_name');
    $subtask->task_id = $taskId;
    $subtask->project_id = $projectId;
    $subtask->save();

    $redirectUrl = 'http://localhost:8000/projects/1/task/'. $taskId .'/subtask';
    return redirect($redirectUrl)->with('warning','Title already exists'); //need redirect here
}

You can do your second redirect also in same way.

21st October, 2017

tisuchi left a reply on How To Use Laravel Alongside With Previously Created Website? • 1 day ago

My simple suggestion, if you have .html site, just convert to laravel. If might be static initially. Than slowly you can migrate to dynamic site slowly...

tisuchi left a reply on Apply Filters On Products Page • 1 day ago

Imagine that, you have a query called something.com/?location=islamabad

Now in your method, you can try this-

$products = Product::latest();


if($location = request('location')){
    $products->where('location', 'LIKE', "%%location%");
}

$products = $products->get();

tisuchi left a reply on Page Loads Takes More Time In Laravel • 1 day ago

where is your code?

20th October, 2017

tisuchi left a reply on Easy Nice Flash Notifications With Flashy ! • 1 day ago

@mercuryseries

Nice work man. I am planning to use this for one of my upcoming project.

tisuchi left a reply on Making Search And Utilizing URL • 2 days ago

No.

Just use-

Route::get('search', '[email protected]');

In all the get url, you can pass any amount of parameters. For example, in above url, you can pass data like this way-

www.example.com/search?type=some&color=blue

tisuchi left a reply on Making Search And Utilizing URL • 2 days ago

Just simply create a get route. Inside your controllers method, just check whether it has value or not.

I highly recommend for your to watch and practice these two series that will increase your understanding about laravel lot.

tisuchi left a reply on Making Search And Utilizing URL • 2 days ago

I see.. Let me start from sketch.

Imagine that, you have two field in your form called-

  • types of car
  • color of car

In html form code, it would be looks like that-

<form action="https://laracasts.com/search" method="POST">
    <input type="text" name="type" />
    <input type="text" name="color" />
    <input type="submit" value="search" />
</form>

Now, if you submit this form, in url you will get something like this-

www.classifieds.com/search?type=some&color=blue

Notice that, two variables type and color were separated by &. This is how you need to pass data into url.

Note: you can eliminate form also, if you want.

Access via url.

Imagine that, you have passed your url like this

www.classifieds.com/search?type=some&color=blue

Now in your controller, you need to receive your value like this way-

public function showSearch(Request $r){
    $type = $r->input('type');
    $color = $r->input('color');

    //do whatever you want now.
}

tisuchi left a reply on Making Search And Utilizing URL • 2 days ago

Let me clear first that whether I can understand you properly or not.

Is that something like this that, you see one result, and I get different result from same link?

www.classifieds.com/search?type=cars+color=blue

tisuchi left a reply on Making Search And Utilizing URL • 2 days ago

If you mean pagination with search url, here is the example-

return view('foldername/filename', [
    'data' => $data->appends($r->input('q'))
]);

tisuchi left a reply on Making Search And Utilizing URL • 2 days ago

https://laracasts.com/search?q=laravel

In your search form-

<form action="https://laracasts.com/search" method="POST">
    <input type="text" name="q" />
    <input type="submit" value="search" />
</form>

In your route-

Route::get('search', '[email protected]');

In your controller-

public function showSearch(Request $r){
    $q = $r->input('q');

    $data = Model::where('someColumn', 'LIKE', "%$q%")->get();

    return $data;
}

tisuchi left a reply on Match File Name With String • 2 days ago

You may try this-

$files = File::latest()->first();
$filename = '';

if($files){
    if($request->input('type') == 'files'){
        
        $filename = $files->filename;
        
        $expd = explode('_', $filename);

        if(count($expd) > 1){
            $filename = 'files_'.$expd[1]+1;
        }

    } else {
        
        $filename = $files->filename;
        
        $expd = explode('_', $filename);

        if(count($expd) > 1){
            $filename = 'files_'.$expd[1]+1;
        }
    }
}


tisuchi left a reply on Error 404 Ajax Post Laravel • 2 days ago

Its because your route is not printing out properly.

In this case, you may use this-

url: "http://localhost/wompra/public/clientes/clientes",

Instead of

   url:"{{ route('clientes-searchcc') }}",

tisuchi left a reply on Error 404 Ajax Post Laravel • 2 days ago

Like this @MonTty

Route::post('/clientes/add', '[email protected]')->name('clientes-searchcc');

This is my ajax call

$.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } });

$.ajax({
   type:'POST',
   url:"{{ route('clientes-searchcc') }}",
   data:{name:"name", password:"password", email:"email"},
   success:function(data){
     console.log(data);
   }
});

19th October, 2017

tisuchi left a reply on Error 404 Ajax Post Laravel • 2 days ago

Because your route name is wrong.

Normally inside route, you need to call route name.

url:"{{ route('put-your-route-name') }}",

Example of your route-

Route::post('some/route/url', '[email protected]')->name('put-your-route-name');

tisuchi left a reply on How To Get Results Except Mine? • 2 days ago

Simply try this-

$advertisements = Advertisement::where('id', '!=', Auth()->id())->get();

It will bring all result except logged in user id.

tisuchi left a reply on Mark Notification As Read • 3 days ago

I am just giving you a rough idea for that.

@foreach(Auth::user()->unreadNotifications as $notification) 
    <li>
        <input type="hidden" id="notificationid" value="{{ $notification->id }}" />
        {{ $notification->whocommented }} has commented on your post.
    </li>
@endforeach

Note: here you may need to adjust id and whocommented.

//call ajax for submitting this form

Now in your controller method-

public function delete(){
    //imagine that you have passed id from ajax form submission
    $id = request()->input('id')

    //assuming that, in notification table there is a column called hasread that is by default 0.
    if($hasNotification = Notification::find($id)){
        $hasNotification->hasread = 1;
        $hasNotification->save();
    }
    return back();
}

tisuchi left a reply on How To Use A Link In Laravel • 3 days ago

What's wrong with your current link?

Doesn't it work for you?

tisuchi left a reply on Delete From Database. • 3 days ago

Can you show your Radius table details?

tisuchi left a reply on HTML Links In Laravel • 3 days ago

@DanielGr

All the things are optional except the first and second parameter.

echo link_to('asia/japan/gyoza.php', $title, $attributes = array(), $secure = null);

First Param = Where you want to redirect

asia/japan/gyoza.php

Second Param = What would be the title for this link

$title

Third Param = If you need to pass any data For instance-

$attributes = Object;

Fourth Param = If you need https url

tisuchi left a reply on Mark Notification As Read • 3 days ago

That's what I said in my previous comment.

Now think of it, if you call markAsRead() it will take notification id as hidden and change the default value of hadread from 0 to 1.

Finally in your unread notification display area, show & count unread when hasread = 0.

tisuchi left a reply on Should I Stick With Resource Controller? • 3 days ago

@alisanie

Normally rule comes to show you to do something in a proper / standard manner. It doesn't mean that you cannot break for betterment. Of course, you can do amendment on that.

To me, it depends on the situation. But again it based on your personal choose also.

I found a nice talk by adam. if you have time, you can watch. https://streamacon.com/video/laracon-us-2017/day-1-adam-wathan

tisuchi left a reply on Why Are "Nested Resources" Not In The Laravel 5.5 Docs? • 3 days ago

It seems not. But not placed in official documentation anymore. But still you can use.

tisuchi left a reply on Why Are "Nested Resources" Not In The Laravel 5.5 Docs? • 3 days ago

Normally they didn't mentioned anything about deprecations.

However, still you are able to use nested resource.

Read this article- http://dev-notes.eu/2016/11/nested-resource-routes-in-laravel/

tisuchi left a reply on HTML Links In Laravel • 3 days ago

Have you tried

echo link_to('asia/japan/gyoza.php', $title, $attributes = array(), $secure = null);

Ref: https://laravel.com/docs/4.2/helpers#urls

tisuchi left a reply on Why Are "Nested Resources" Not In The Laravel 5.5 Docs? • 3 days ago

You know what, compare from laravel 5.1 with 5.5, there are massive structural differences. There are lot of changes has made in around 1 year. The Nested Resources has removed from laravel since version 5.2

https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0

18th October, 2017

tisuchi left a reply on How To Get My Current Lat,lng Based On My Location • 3 days ago

Well, I think there are two ways to achieve that.

  • Get location from mobile location (User must have to on mobile location)
  • Get location via user's IP. In most of the cases, getting details from IP is not that accurate.

tisuchi left a reply on How To Get My Current Lat,lng Based On My Location • 3 days ago

You mentioned something called-

mobile web app

Isn't that an app accessible via mobile?

tisuchi left a reply on How To Get My Current Lat,lng Based On My Location • 3 days ago

Its really hard to get the exact location from web application.

However, I use a package in laravel called laravel-geoip. Here is the code that how I get current visitor's details-

 //setting user Current City by IP Address
        $location = GeoIP::getLocation();
        $country = $location['country'];
        $city = $location['city'];
        $state = $location['state'];
        $lat = $location['lat'];
        $lng = $location['lon'];

Ref: https://github.com/Torann/laravel-geoip

tisuchi left a reply on Mark Notification As Read • 3 days ago

In your notification table, set a column hasread where by default value is 0.

Now think of it, if you call markAsRead() it will take notification id as hidden and change the default value of hadread from 0 to 1.

Finally in your unread notification display area, show & count unread when hasread = 0.

tisuchi left a reply on Delete From Database. • 3 days ago

@imposition

Problem 1: Still I am confused about it. Let me clear first.

You have few records with same username where username is a primary key. Now you want to delete it, how to do that, right?

Can you show me your delete method code?

Problem 2:

Just check whether the data has record or not. That's all. For instance-

@if($data)
    @foreach($data as $d)
        <tr>
            <td> {{ $d['UserName'] }}</td>                  
            <td>{{ $d['ipAddress'] }}</td>
            <td><a href="#" onclick="return confirm('Deseja realmente excluir esse item?');"><i class="fa fa-trash" aria-hidden="true"></i></a></td>
        </tr>
    @endforeach
@endif

tisuchi left a reply on Delete From Database. • 4 days ago

Can you show your code?

tisuchi left a reply on Handling Html Tag • 4 days ago

tisuchi left a reply on Ordering Dates • 4 days ago

Doesn't it work for you?

$view->with('events', Events::orderBy('date', 'desc')->where('archived', false)->limit(3)->get());

tisuchi left a reply on Handling Html Tag • 4 days ago

You can print your html tag like this way {!! !!}.

For instance-

{!! $pages2->pages_content !!}

17th October, 2017

tisuchi left a reply on Adding Username To Database(migration) Using Auth::user • 5 days ago

show your users table columns.

tisuchi left a reply on Adding Username To Database(migration) Using Auth::user • 5 days ago

Yes, you are right.

Just change your method a bit.

public function store(Request $request)
    {
        request()->validate([
            'username' => 'required', //I will get rid of this
            'post' => 'required',
            'location' => 'required',
        ]);

        
        $post = new Post();
        $post->username = Auth::user()->username;
        $post->post = $request->input('post');
        $post->location = $request->input('location');
        $post->save();

        return redirect()->route('post.index')
                        ->with('success','Post created successfully');
    }

Note: Make sure that you have imported auth top of the class like follows-

use Auth;

tisuchi left a reply on Form Issue • 5 days ago

show your code.

tisuchi left a reply on Laravel OrderBY With Specific Value • 5 days ago

Apart from @bashy answer, you can think of that you pass country name as a parameter in url.

For example-

something.com/?location=india

Now in your method, you can try this-

$users = User::latest();


if($location = request('location')){
    $users->where('location', 'LIKE', "%%location%");
}

$users = $users->get();

tisuchi left a reply on How To Make Tag Input • 5 days ago

can you show your code?

tisuchi left a reply on Model Relationship Not Working Out As Expected. Keeps Using Wrong Foreign Id. • 5 days ago

In this case, employee_layouts table should carry user_settings id as a foreign key.

For example- employee_layouts table

  • id
  • user_settings_id
  • add more
  • and more

Its because you are trying to access via-

  • a specific user
    • who has user setting
      • where it has employee layout

So, employee layout basically related to user setting table. That's why its not working.

tisuchi left a reply on How To Make Tag Input • 5 days ago

I see.. I just highly recommend you to watch this full series. It might take few hours for you to watch, but it will increase your workflow tremendously.

https://laracasts.com/series/laravel-from-scratch-2017

Your issue will be discussed in episode 30.

tisuchi left a reply on Poor WhereHas Performance • 5 days ago

I missed that man...

40M!...

I don't know how can help you. However, I can suggest you to watch this series. It's all about optimization.

https://serversforhackers.com/laravel-perf This series can be helpful for you.

tisuchi left a reply on Login Authentication Malfunction. • 5 days ago

@harriesbmariano

Your coding is missing. Specially http folder is empty.

Why not you use github.com and create a repo there to show your code?

tisuchi left a reply on Poor WhereHas Performance • 5 days ago

Can you show your view page?

How many data you have?

Edit Your Profile
Update

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