tisuchi

Developer at EDV Standard

Hire Me

Experience

303,035

200 Best Reply Awards

  • Member Since 3 Years Ago
  • 1041 Lessons Completed
  • 12 Favorites

31st May, 2018

tisuchi left a reply on How To Use 'use App\Profile' Like This Inside Blade • 2 weeks ago

Just use-

App\Profile::get();

Although, it is not the best practice to call model in view.

30th May, 2018

tisuchi left a reply on Google Autocomplete Address • 2 weeks ago

@deepu07

Although it's a long time, however, what I can remember, it was because of css z-index issue. That's why it was not pop up. Make sure, you don't have that.

29th May, 2018

tisuchi left a reply on Get All Team Members Job Sites If Current User Is The Owner Of The Team • 2 weeks ago

Since its an authorization part, you can use Gate at Laravel [1].

Another approach can be establishing relationships between user and job site. Then you just check whether that user is eligible for modify or not by using logic.

  1. https://laravel.com/docs/5.6/authorization#gates

tisuchi left a reply on Creating A Function Like Auth::user() • 2 weeks ago

There are few options in that case. Check it out following discussion. https://stackoverflow.com/questions/25189427/global-variable-for-all-controller-and-views

Another option that is in my mind is to use a helper function that is also accessible.

tisuchi left a reply on Print Team Names Instead Of IDs. (Laravel 5.4) • 2 weeks ago

In a shortcut way, I can think of-

You need to establish another relationship for team. For example-

class Match extends Model
{
    
    //realtionship for team 1
    public function team1(){
      return $this->belongsTo('App\Team', 'team_1_id');
    }

    //relationship for team 2
    public function team2(){
      return $this->belongsTo('App\Team', 'team_2_id');
    }
}

Now you can call in your view like that way-

<td align="center">{{$match->team1->name }}</td>
<td align="center">{{$match->team2->name}}</td>

Note: I assume that, in your team table, there is a column name called name where you have stored team name. If it is different name, please update in view.

tisuchi left a reply on Test Case For HTML Select Option Spoofing • 2 weeks ago

What is new CountryRule?

I have a suggestion for you. Never call model in your blade. It's not a best practice.

tisuchi left a reply on Creating A Function Like Auth::user() • 2 weeks ago

Since you are planning for global variable and if its a static data (not change frequently), then you can store this data to .env file.

####How to store? In .env file, add-

SURVEY_NAME=Name

####How to Access? You can easily call .env variable from anywhere of your application. For instance-

{{ env('SURVEY_NAME') }}

tisuchi left a reply on Base Table Or View Already Exists Migration • 2 weeks ago

One of the easiest way to do that by adding a line of code Schema::dropIfExists('migration'); in your migration table.

public function up()
{
    Schema::dropIfExists('migration');
    Schema::create('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->timestamps();
    });
}

It won't refresh your data in other table.

However, if your data is not important, then you can try this-

php artisan migrate:reset 

28th May, 2018

tisuchi left a reply on Error When Running Phpunit • 3 weeks ago

You better show your code. It seems that you have make some mistake.

tisuchi left a reply on Refrsh-token • 3 weeks ago

Have you seen this?

$http = new GuzzleHttp\Client;

$response = $http->post('http://your-app.com/oauth/token', [
    'form_params' => [
        'grant_type' => 'refresh_token',
        'refresh_token' => 'the-refresh-token',
        'client_id' => 'client-id',
        'client_secret' => 'client-secret',
        'scope' => '',
    ],
]);

return json_decode((string) $response->getBody(), true);

Ref: https://laravel.com/docs/5.6/passport

tisuchi left a reply on A Way To Store Site Settings In Laravel • 3 weeks ago

What I can think of right now is-

  • Store everything in DB.
  • Separate the configuration data and regular admin information.
  • Fetch configuration data from db and store as an environment variable.
  • Created another config file for storing regular admin information.

tisuchi left a reply on A Way To Store Site Settings In Laravel • 3 weeks ago

@chori.av

Since it's somehow related to configuration, I suggest you to store in .env that is the way more secure and best practice.

tisuchi left a reply on How To Get Header Authorisation Code From Postman? • 3 weeks ago

@hasandev

Have you tried this? (Not tested)

public function yourControllerFunction(Request $request)
{
    $header = $request->header('Authorization');
    //some other logic
}

tisuchi left a reply on A Way To Store Site Settings In Laravel • 3 weeks ago

If it is after logged in as an Admin, I always prefer to store in DB.

27th May, 2018

tisuchi left a reply on How To Generate Random Token / Key? • 3 weeks ago

Maybe there is another approach. But I always love to use str_random() function that is a core function of PHP.

You can try this-

str_random(32)

16th May, 2018

tisuchi left a reply on TokenMismatchException In VerifyCsrfToken.php Line 68: • 1 month ago

Thank you @Shahrukh4

The problem was solved in 1 year ago in my side. :)

10th April, 2018

tisuchi left a reply on 3 Table Relationships • 2 months ago

A rough idea can be-

  • A Student belongs to a Guardian
  • A guardian has many students
  • A family belongs to a Guardian
  • A guardian has many families
  • A family has many members

Now you need to write your relationships code like that way.

tisuchi left a reply on Why My Laravel Website Is So Slow? • 2 months ago

In the local environment, you can install Debugbar and see check what makes your site slower and optimize that portion.

https://github.com/barryvdh/laravel-debugbar

tisuchi left a reply on Facaing Problem In Transfering Website • 2 months ago

In your project folder, there is a file named .env. If it is missing, go to the following repo, copy the code from there and add to your project.

https://github.com/laravel/laravel/blob/master/.env.example

tisuchi left a reply on Page Reload On Browser Back Button. • 2 months ago

I think you cannot use laravel to detect that. So, you have to use javascript to detect on the web.

Check this discussion. https://stackoverflow.com/questions/25806608/how-to-detect-browser-back-button-event-cross-browser

tisuchi left a reply on Can Someone Please Explain A Bit About Messages 101 In OOP Bootcamp • 2 months ago

It's called dependency injection in PHP. In a nutshell, it's like call class without instantiation.

Refer you to read following articles-

tisuchi left a reply on Find() Not Working Properly • 2 months ago

find() works with the primary key of a table. Make sure you are passing primary key as a param.

9th April, 2018

tisuchi left a reply on Search Within Multiple Tables/models • 2 months ago

@basvandertogt

Have you tried algolia? What I mentioned there is algolia. Not pusher. Algolia is one of the best choose for full text search.

https://www.algolia.com/doc/api-client/laravel/algolia-and-scout/

7th April, 2018

tisuchi left a reply on I'm New, Where Can I Start??? • 2 months ago

Welcome to laravel.

I just refer to another answer-

https://laracasts.com/discuss/channels/tips/new-to-laravel-6

tisuchi left a reply on How Do You Change The Default Id That Gets Passed Into The Controller? • 2 months ago

If you need to change the default id / Primary key, you need to define in your model.

For instance-

class Product extends Eloquent {

    protected $primaryKey = 'my_new_primary_column_name';

}

3rd April, 2018

tisuchi left a reply on Search Within Multiple Tables/models • 2 months ago

If you are looking for something from the sketch, you can use join tables.

For the third party, you can use Scout with the pusher.

1st April, 2018

tisuchi left a reply on Is There Any Way To Optimize This Query? • 2 months ago

I think you can rewrite it this way-

$category = $category->load(['products' => function($query){
                $query->whereHas('features.field.show_list', 1);
            }])->whereHas('features.value_number', 2);

Note: The code has not been checked.

28th March, 2018

tisuchi left a reply on Change Connection Through UI • 2 months ago

A rough idea can be-

  • Use UI for changing DB connection configuration
  • You can access .env variable from the model, and decide that what should be the table name based on connection.

tisuchi left a reply on Why My Json Data Does Not Show From API Database • 2 months ago

@towhid

All the best man.

27th March, 2018

tisuchi left a reply on Why My Json Data Does Not Show From API Database • 2 months ago

@towhid

Sorry to say, however, I feel it's really prerequisite for your to learn API building/fetching.

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

tisuchi left a reply on How To Show Arabic In Laravel/dompdf ??? • 2 months ago

@abubakaroffc

There are still few open discussion in dompdf. You can closely look all of them. I hope you will get your answer.

https://github.com/barryvdh/laravel-dompdf/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+arabic

tisuchi left a reply on Required_without... But Not Both? • 2 months ago

@ldslaracasts

If I get you correctly, have you tired with something?

https://laravel.com/docs/5.6/validation#conditionally-adding-rules

18th March, 2018

tisuchi left a reply on How To Forward A Request With Parameters/arguments To A Different URL? • 2 months ago

First of all, if you have to perform some other task, the redirect is not an appropriate choice here.

after performing some actions

Maybe, you can simply get GET value from URL, then perform whatever you want and redirect to your expected url.

14th March, 2018

tisuchi left a reply on E-commerce In Laravel • 3 months ago

@pkundariya

What I can suggest you, just take a html template that you have liked. Then implement it on any open source laravel package.

13th March, 2018

tisuchi left a reply on VerifyCsrfToken.php • 3 months ago

The VerifyCsrfToken occurs when a form submits without csrf value. In this case, I shouldn't have credentials to check error. That should be correct as long as form has submitted without error.

12th March, 2018

tisuchi left a reply on VerifyCsrfToken.php • 3 months ago

Since you have csrf validation, you shouldn't see that error anymore.

I have checked, but there is no VerifyCsrfToken on my side.

blob:https://imgur.com/7087d65a-f136-421e-9488-2b9b7d7e0303

tisuchi left a reply on VerifyCsrfToken.php • 3 months ago

Have you used csrf token field?

{{ csrf_field() }}

Use above code inside form.

tisuchi left a reply on VerifyCsrfToken.php • 3 months ago

You need to use following code inside your form.

{{ csrf_field() }} 

or

<input type="hidden" name="_token" value="{{ csrf_token() }}" />

6th March, 2018

tisuchi left a reply on Open Source Laravel Project Management Tool • 3 months ago

I think ribbbon could be suitable for you.

https://github.com/canvasowl/ribbbon

tisuchi left a reply on Get Records Per Hour • 3 months ago

If you are looking for data those have created within a certain time period, you can try this-

$date = new Carbon;

$weekly = Table::where('created_at', '>', $date->subHours(3))->get();

tisuchi left a reply on Password Doesn't Match When Login On Laravel 5.3 • 3 months ago

You better show your code.

12th February, 2018

tisuchi left a reply on Get One Data From Each Duplicate Data Row • 4 months ago

@wardaddy

I can't see any issue with that in my side.

$years = ItemIn::groupBy(DB::raw('MONTH(created_at)'))->pluck('created_at');

11th February, 2018

tisuchi left a reply on Get One Data From Each Duplicate Data Row • 4 months ago

@wardaddy

MONTH() should be inside single quote.

$years = User::where(DB::raw('MONTH(created_at)'), 02)->distinct('created_at')->pluck('created_at');
Edit Your Profile
Update

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