Saturday, July 3, 2021

Buy 123Movies Clone Wordpress Theme

https://fuzzymovies.com/123-movies-buy-script/ 

123Movies Clone Wordpress Theme


Download 123 movies or Gomovies clone WordPress theme!

Gomovies Clone is one of the best wordpress theme for movies and tv-series content. Gomovies Clone wordpress theme is based on the design of the popular site 123movies. It has a powerful tool that will help you generate and complete almost all the necessary contents needed with just a click.

Gomovies Clone is the most ideal theme for movies and series contents. It has a variety of tools and settings which you can configure on Gomovies Clone Option Framework. It has all the things you needed to personalize your site without having to change the codes. Gomovies Clone is a completely responsive theme and is SEO optimized. This theme also has a powerful tool that generates huge amount of contents. Gomovies Clone’s JS & CSS files are all minified and has an option to minify the HTML output of your site as well which could help you increase your site’s speed.

Gomovies Clone Key Features

  • Child Theme
  • Flat, Clean & Modern design.
  • Responsive design , adaptable to almost any resolution.
  • Adapted for SEO
  • AddThis social buttons
  • Night Mode Theme Switcher
  • Default Theme Mode selector (Light or Dark) *new*
  • Theme Color Scheme Changer (Green, Blue, Red, Orange, Purple, Pink) *new*
  • Splash Image & Button (like gomovies) *new*
  • Pre-Made Style Changer (GoMovies.to Style) *new*
  • Live Search *new*
  • Hoomepage Search *new*
  • Request Page *new*
  • Featured Slider
  • Latest News/Articles
  • Article & Movie Linker.
  • Notice on First Visit. Cookie based.
  • Homepage Modules: Latest Movies, Latest TV-Series, Latest Episodes
  • Post Types: Articles, Movies, TVShows, Episodes.
  • Theme Options – Total control framework .
  • IMDb / TMDb API. Content / Data Generator
  • Episodes Generator.
  • Download Tables: Download links, Watch Links, Subtitle Links
  • Easy translation. Compatible with My WP Translate .
  • Ads Complete Management
  • User System: My Profile, My Favorites, Update Profile
  • Settings for Facebook APP to edit comments.
  • HTML Minifier & Minified JS & CSS files .
  • Turn off Lights
  • Report Content
  • Favorites.
  • WP-PostRatings.
  • WP-PostViews.
  • Top Contents – Top IMDb, Top Rating, Most Viewed, Most Favorite.
  • Related content
  • Duplicate content checker
  • Custom registration form and login.
  • Modal Login / Registration / Reset Password
  • Security check on all forms.
  • reCaptcha on forms.
  • Ads – Fake Player
  • Ads- Fake Buttons.

Monday, December 14, 2020

CSS post-processing using autoprefixer in a React app

CSS post-processing using autoprefixer in a React app: CSS post-processing using autoprefixer in a React app create-react-app CLI supports CSS post-processing to add vendor prefixes based on the configuration.What is vendor prefixes?Browser updates their version

Saturday, December 15, 2018

Github Account Deleter

I've made a simple presentation on how to create a simple python script to delete the repos that you dont need anymore
https://colab.research.google.com/drive/13BBnj7JBTOwrIOWRrrS9xuDoRWZC04ja

Monday, May 21, 2018

Eloquent Sluggable Package - development

Eloquent Sluggable Package

Adding unique slugs to your eloquent models is made simple through the Eloquent Sluggable package by Colin Viebrock. The gist of using this package is making your Eloquent models “sluggable” through the ‘Sluggable’ trait provided by the package, which defines an abstract sluggable() method you use to configure your model-specific configuration. Learn how to add slugs to your Laravel models with ease using this package!

Visit Laravel News for the full post.

The post Eloquent Sluggable Package appeared first on Laravel News.



from Laravel Questions and Answers https://laravelquestions.com/news/eloquent-sluggable-package/
via Lzo Media

Sunday, May 20, 2018

Laravel 5.5 save filename to database as *.tmp - development

Laravel 5.5 save filename to database as *.tmp

I want to save my post with linked image/
My model:

class Performer extends Model
{
    protected $fillable = ['title','slug','logoimage','description','address','toplace','exp','workers','published','created_by','modified_by'];

    public function categories() {
        return $this->morphToMany('AppCategory', 'categoryable');
    }

    public function SetSlugAttribute($value)
  {
    $this->attributes['slug'] = Str::slug(mb_substr($this->title, 0, 40) . "-". CarbonCarbon::now()->format('dmyHi'), '-');
  }
}

My controller:

public function store(Request $request) {

       // dd($request);
        $performer = Performer::create($request->all());

        if ($request->input('categories')){
            $performer->categories()->attach($request->input('categories'));
        }

        if ($request->hasfile('logoimage')){
          $image = $request->file('logoimage');
          $filename = time().'.'.$image->getClientOriginalExtension();
          $location = public_path('images/uploads/logo/'.$filename);
          Image::make($image)->resize(100, 100)->save($location);
          // dd($filename); - return normal filename, 857857857.jpg as example
          $performer->logoimage= $filename;

        }


        return redirect()->route('admin.performer.index');
    }

View:

<input type="file" class="form-control" name="logoimage">

enctype=”multipart/form-data” is enabled in form.

Result:
Images saved to folder publicimagesuploadslogo normally, with *.jpg names
To database (logoimage column) saved as C:xampptmpphp915C.tmp.
WHY?
How to fix it?



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-5-5-save-filename-to-database-as-tmp/
via Lzo Media

Add more column in existing table but it doesn’t [duplicate] - development

Add more column in existing table but it doesn’t [duplicate]

This question already has an answer here:

$ php artisan migrate

In Connection.php line 647:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
  ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr
  ement primary key, `name` varchar(191) not null, `email` varchar(191) not n
  ull, `password` varchar(191) not null, `remember_token` varchar(100) null,
  `created_at` timestamp null, `updated_at` timestamp null) default character
   set utf8mb4 collate utf8mb4_unicode_ci)


In Connection.php line 449:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
  ady exists

I am trying to add more column into users table but I can’t. In terminal I write command php artisan migrate but Base table or view already exists: 1050 Table ‘users’ already exists. What can I do now?



from Laravel Questions and Answers https://laravelquestions.com/php/add-more-column-in-existing-table-but-it-doesnt-duplicate/
via Lzo Media

Laravel on Window 10 using Wamp gives and error - development

Laravel on Window 10 using Wamp gives and error

I installed Laravel(5.6) on windows 10 with Wamp(3.1.). When I run the index file in Public folder in laravel to check if it is correctly installed or not using browser url, I get the following error:

Parse error: syntax error, unexpected ‘?’ in
C:wamp64wwwlaravelvendorlaravelframeworksrcIlluminateFoundationhelpers.php
on line 242.

So how can I solve this?



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-on-window-10-using-wamp-gives-and-error/
via Lzo Media

Laravel Eloquent with() method works with ‘where’ but doesn’t work with ‘Model::find’ - development

Laravel Eloquent with() method works with ‘where’ but doesn’t work with ‘Model::find’

I want to have relationship between 3 tables, using Laravel Eloquent with() method.
this is my code (relationships are set in models):

    $request_form = RequestForm::find(7)->with(['RequestFormsCheck' => function ($q) {
        $q->orderBy("created_at", "DESC")->with('RequestFormsCheckOptions');
    }])->get();

    dd($request_form);

but this code returns all request forms except returning only id = 7
this is output:

Collection {#895 ▼
  #items: array:4 [▼
    0 => RequestForm {#796 ▶}
    1 => RequestForm {#797 ▶}
    2 => RequestForm {#798 ▶}
    3 => RequestForm {#799 ▶}
  ]
}

when I replace ->get() with ->first() it returns just request form, but its id is 1 🙁

but this code works great:

        $request_form = RequestForm::where('id', 7)->with(['RequestFormsCheck' => function ($q) {
            $q->orderBy("created_at", "DESC")->with('RequestFormsCheckOptions');
        }])->first();

        dd($request_form->toArray());

and this is its output (this is what I expect to get):

array:12 [▼
  "id" => 7
  "name" => "Jack"
  "email" => "jack@gmail.com"
  "telephone" => null
  "description" => "..."
  "site" => "http://branch.local/"
  "item_id" => 10
  "lang" => "en"
  "read" => 1
  "created_at" => "2018-05-15 11:09:47"
  "updated_at" => "2018-05-20 05:24:41"
  "request_forms_check" => array:1 [▼
    0 => array:8 [▼
      "id" => 1
      "request_form_id" => 7
      "type" => 2
      "request_forms_check_options_id" => null
      "description" => "custom note"
      "created_at" => "2018-05-15 11:48:36"
      "updated_at" => "2018-05-15 11:48:36"
      "request_forms_check_options" => null
    ]
  ]
]

these are my migrations:

    Schema::create('request_forms', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name', 100)->nullable();
        $table->string('email', 100)->nullable();
        $table->string('telephone', 20)->nullable();
        $table->text('description')->nullable();
        $table->string('site', 100);
        $table->integer('item_id');
        $table->string('lang');
        $table->timestamps();
    });

and

    Schema::create('request_forms_check_options', function (Blueprint $table) {
        $table->increments('id');
        $table->string('title', 500);
        $table->timestamps();
    });

and this

    Schema::create('request_forms_checks', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('request_form_id')->unsigned();
        $table->foreign('request_form_id')->references('id')->on('request_forms')->onDelete('cascade');
        $table->tinyInteger('type')->comment("1: option, 2:description");
        $table->integer('request_forms_check_options_id')->unsigned()->nullable();
        $table->foreign('request_forms_check_options_id')->references('id')->on('request_forms_check_options')->onDelete('cascade');
        $table->text('description')->nullable();
        $table->timestamps();
    });



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-eloquent-with-method-works-with-where-but-doesnt-work-with-modelfind/
via Lzo Media

Laravel- arranging records in ascending and descending order - development

Laravel- arranging records in ascending and descending order

I have a create method in my controller

public function create()
{
$image = PropertyUser::where('user_id', '=', Auth::user()->id)->get();
foreach($image as $property)
{
    $id = $property->property_id;
}
$image_main = Image::where('property_id', $id)->get();
return view('settings.photos', ['image_array' => $image_main]);
}

This is my photos.blade file

<form name="asc" action="" method="post" class="text-center">
    @csrf
    <input type="submit"  value="Ascending " class="settings-photos-header2 text-center"/>  |
</form><form name="dec" action="" method="post"  class="text-center">
    @csrf
    <input type="submit"  value= " Descending" class="settings-photos-header2 text-center"/>
</form>
<h2 class="settings-photos-header2 text-center">Photo Gallery</h2>
@foreach ($image_array as $images)
    <div class="image-warp"><img src=""
                                 style="width:100px;height:100px;"><br/><span style="color: #1b1e21"></span>
    </form>
    </div>
    @endforeach

Question- How can i make the asc button sort the images in ascending order and des in descending order, is there a way to connect it to my controller, or is there a way to sort them in ascending and descending order through any other means?



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-arranging-records-in-ascending-and-descending-order/
via Lzo Media

Using Intervention package to compress images. My images are not being compressed, still the same size - development

Using Intervention package to compress images. My images are not being compressed, still the same size

I’m using this package http://image.intervention.io/getting_started/installation to compress my images that’s uploaded to my server. However the images are not being compressed.

  1. First I installed the Intervention package by putting this in my
    terminal:

    composer require intervention/image

  2. Then I added this at the top of my controller:

    use InterventionImageImageManagerStatic as Image;

  3. Then I added the encode to minify the image

    Image::make(request()->file(‘img’))->encode(‘jpg’, 1);

  4. It’s not minifying the image. It’s still the same size.

    <?php
    
    namespace AppHttpControllers;
    
    use InterventionImageImageManagerStatic as Image;
    use IlluminateSupportFacadesStorage;
    use IlluminateHttpRequest;
    
    class UploadsController extends Controller
    {
    
        public function store()
        {
    
            // Get image
            $img = request()->file('img');
    
            // Minify image
            Image::make($img)->encode('jpg', 1);
    
            // Store image in uploads folder
            Storage::disk('public')->put('uploads', $img);
    
        }
    
    }
    
    


from Laravel Questions and Answers https://laravelquestions.com/php/using-intervention-package-to-compress-images-my-images-are-not-being-compressed-still-the-same-size/
via Lzo Media

URL generation removes port - development

URL generation removes port

I was trying to send an email when I encountered this error. So what I did is I created an event and on it’s listeners I want to send an email that will validate it’s email address. Just to be sure that everything will be secure I tried using URL::signedRoute to create a URL wherein if the user would click on it, it will go to the address produced by URL::signedRoute. What I just notice is that on the url that it created, there was no port in it.

Heres my mailable class

<?php

namespace AppMail;

use AppUser;
use IlluminateBusQueueable;
use IlluminateMailMailable;
use IlluminateQueueSerializesModels;
use IlluminateContractsQueueShouldQueue;
use IlluminateSupportFacadesURL;

class AccountValidation extends Mailable
{
    use Queueable, SerializesModels;

    public $user,$link;

    public function __construct(User $user)
    {
        $this->user = $user;
        $this->link = URL::temporarySignedRoute(
            'activateaccount', now()->addHour(), ['email'=>$user->email,'answer'=>'1']
        );
    }

    public function build()
    {
        return $this->from('welly@wellington.com')->view('emails.accountvalidation');
    }
}

The address from web.php

Route::get('/activate/{email}/{answer}','MyController@activateaccount')->name('activateaccount')->middleware('signed');

Here’s the URL that it produced.

http://localhost/activate/ewan@yahoo.com/1?expires=1526801279&amp;signature=823cfaece0a5184db2ef7e79e3f4bc9e3b4cbf362b98884323b0fe2605886912

I want the URL to have port 8000 like http://localhost:8000. Thank you for helping and excuse my grammar.



from Laravel Questions and Answers https://laravelquestions.com/php/url-generation-removes-port/
via Lzo Media

count in laravel 5.3 - development

count in laravel 5.3

I want to count table users row in laravel 5.3.

Here is my code Controller:

public function admin(){
    $jumlah['data'] = DB::table('users')->get();
    return view('admin',$jumlah);
}

In view, I call this count with :



Then I run and I get the message:

Undefined variable: jumlah (View: C:xampphtdocsBiroUmumresourcesviewsdashboardadmin.blade.php)



from Laravel Questions and Answers https://laravelquestions.com/php/count-in-laravel-5-3/
via Lzo Media

Get many to many from polymorphic table ID - development

Get many to many from polymorphic table ID

Using Laravel 5.1, how can I get Dialogs from a M:M relationship with a Polymorphic table.

When I load tasks, it loads the appropriate npc. This relationship between tasks and npcs is a Polymorphic relation.

So I created another M:M table, dialog_npcseventsmorphable, that links the dialog_id to the npcs_events_morphable_id on npcs_events_morphable table, but it is not loading the dialogs.

$task = Task::findOrFail(1);

npcs_events_morphable:

 id | npc_id | morphable_id | morphable_type |     created_at      |     updated_at      |    published_at     
----+--------+--------------+----------------+---------------------+---------------------+---------------------
  1 |      1 |            1 | AppTask       | 2018-05-20 04:45:24 | 2018-05-20 04:45:24 | 2018-05-20 04:45:24
  2 |      2 |            1 | AppActivity   | 2018-05-20 04:45:24 | 2018-05-20 04:45:24 | 2018-05-20 04:45:24
  3 |      3 |            1 | AppBattle     | 2018-05-20 04:45:24 | 2018-05-20 04:45:24 | 2018-05-20 04:45:24

dialog_npcseventsmorphable:

 dialog_id | npcs_events_morphable_id (<-- id on 'npcs_events_morphable' table)
-----------+--------------------------
         1 |                        1
         2 |                        1
         3 |                        2
         4 |                        2
         5 |                        3
         6 |                        3
         7 |                        3
         8 |                        3
         9 |                        3

Task:

class Task extends BaseModel
{
    protected $with = ['npcs', ...];

    public function npcs()
    {
        return $this->morphToMany('AppNpc', 'morphable', 'npcs_events_morphable');
    }
}

Npc:

class Npc extends BaseModel
{
    public function tasks()
    {
        return $this->morphedByMany('AppTask', 'morphable', 'npcs_events_morphable');
    }
    ...
}

Dialog:

class Dialog extends BaseModel
{
    public function npcs()
    {
        return $this->belongsToMany(NpcsEventsMorphable::class, 'dialog_npcseventsmorphable');
    }
    ...
}

NpcsEventsMorphable:

class NpcsEventsMorphable extends BaseModel
{
    protected $table = 'npcs_events_morphable';

    protected $with = ['dialogs'];

    public function dialogs()
    {
        return $this->belongsToMany(Dialog::class, 'dialog_npcseventsmorphable');
    }
}

}



from Laravel Questions and Answers https://laravelquestions.com/php/get-many-to-many-from-polymorphic-table-id/
via Lzo Media

Convert row data into column data using Laravel - development

Convert row data into column data using Laravel

Hello I am facing a problem. I am trying at my best to solve this but can not. I am trying to do this I have three table which is illustrated below image. I want to Output like last table in the given image

And this is my laravel code——————

$academic_year=$request->academic_year;
        $class=$request->class_name;
        $medium=$request->medium;
        $section=$request->section_name;        
        $exam_name=$request->exam_name;

        $subject_list=DB::table('tbl_subject')                    
                    ->where('class_name', 'LIKE', "%$class%")                                       
                    ->get();     


$student_all_subject_mark_search_result=DB::table('tbl_student_subject_mark') 
            ->join('tbl_student_admission', 'tbl_student_subject_mark.student_registration_id', '=', 'tbl_student_admission.student_registration_id')
            ->select('tbl_student_subject_mark.*', 'tbl_student_admission.student_registration_id',  'tbl_student_admission.student_full_name_english', 'tbl_student_admission.class', 'tbl_student_admission.medium', 'tbl_student_admission.section', 'tbl_student_admission.roll_no',
            'max(if(subject_name = "Bangla 1st Paper" , total_obtained_mark, null)) A',
            'max(if(subject_name = "Bangla 2nd Paper" , total_obtained_mark, null)) B',
            'max(if(subject_name = "English 1st Paper" , total_obtained_mark, null)) C',
            'max(if(subject_name = "English 2nd Paper" , total_obtained_mark, null)) D',
            'max(if(subject_name = "Mathematics" , total_obtained_mark, null)) E',
            'max(if(subject_name = "Religion" , total_obtained_mark, null)) F')
            ->where('tbl_student_subject_mark.academic_year', $academic_year)
            ->where('tbl_student_admission.class', $class)
            ->where('tbl_student_admission.medium', $medium)
            ->where('tbl_student_admission.section', $section)                
            ->where('tbl_student_subject_mark.exam_title', $exam_name)
            ->where('tbl_student_admission.student_registration_id is not null')
            ->groupBy('tbl_student_subject_mark.student_registration_id')                
            ->get();

But It shows an error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'max(if(subject_name 
= "Bangla 1st Paper" , total_obtained_mark, null)) A' in 'field list' (SQL: 
select `tbl_student_subject_mark`.*, 
`tbl_student_admission`.`student_registration_id`, ..................



from Laravel Questions and Answers https://laravelquestions.com/laravel/convert-row-data-into-column-data-using-laravel/
via Lzo Media

Saturday, May 19, 2018

Why Design layout does not work in laravel in auth:make command - development

Why Design layout does not work in laravel in auth:make command

I’m new to laravel and I’m using laravel 5.6 but the problem is when I run auth:make command it execute and display some login field and register field. My question is why design layout is not working after running auth:make command in laravel. I have uploaded image it shows only html content but design layout is not showing.

Image link



from Laravel Questions and Answers https://laravelquestions.com/php/why-design-layout-does-not-work-in-laravel-in-authmake-command/
via Lzo Media

how to change tymon jwt authentication to use member model instead of user model in laravel 5.6? - development

how to change tymon jwt authentication to use member model instead of user model in laravel 5.6?

In my project I have users and members tables and eloquent models.
I’m going to use jwt authentication in members table and I changed corresponding config files, but still it goes to User model.

Here is config/auth.php :

return [

/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/

'defaults' => [
    'guard' => 'web',
    'passwords' => 'users',
],

/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'jwt',
        'provider' => 'members',
    ],
],

/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => AppUser::class,
    ],

    'members' => [
        'driver' => 'eloquent',
        'model' => AppModelsMember::class
    ]

    // 'users' => [
    //     'driver' => 'database',
    //     'table' => 'users',
    // ],
],

/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/

'passwords' => [
    'users' => [
        'provider' => 'users',
        'table' => 'password_resets',
        'expire' => 60,
    ],
],
];

And here is config/jwt.php:

return [

/*
|--------------------------------------------------------------------------
| JWT Authentication Secret
|--------------------------------------------------------------------------
|
| Don't forget to set this, as it will be used to sign your tokens.
| A helper command is provided for this: `php artisan jwt:generate`
|
*/

'secret' => env('JWT_SECRET', 'changeme'),

/*
|--------------------------------------------------------------------------
| JWT time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token will be valid for.
| Defaults to 1 hour
|
*/

'ttl' => 60,

/*
|--------------------------------------------------------------------------
| Refresh time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token can be refreshed
| within. I.E. The user can refresh their token within a 2 week window of
| the original token being created until they must re-authenticate.
| Defaults to 2 weeks
|
*/

'refresh_ttl' => 20160,

/*
|--------------------------------------------------------------------------
| JWT hashing algorithm
|--------------------------------------------------------------------------
|
| Specify the hashing algorithm that will be used to sign the token.
|
| See here: https://github.com/namshi/jose/tree/2.2.0/src/Namshi/JOSE/Signer
| for possible values
|
*/

'algo' => 'HS256',

/*
|--------------------------------------------------------------------------
| User Model namespace
|--------------------------------------------------------------------------
|
| Specify the full namespace to your User model.
| e.g. 'AcmeEntitiesUser'
|
*/

'user' => 'AppModelsMember',

/*
|--------------------------------------------------------------------------
| User identifier
|--------------------------------------------------------------------------
|
| Specify a unique property of the user that will be added as the 'sub'
| claim of the token payload.
|
*/

'identifier' => 'id',

/*
|--------------------------------------------------------------------------
| Required Claims
|--------------------------------------------------------------------------
|
| Specify the required claims that must exist in any token.
| A TokenInvalidException will be thrown if any of these claims are not
| present in the payload.
|
*/

'required_claims' => ['iss', 'iat', 'exp', 'nbf', 'sub', 'jti'],

/*
|--------------------------------------------------------------------------
| Blacklist Enabled
|--------------------------------------------------------------------------
|
| In order to invalidate tokens, you must have the blacklist enabled.
| If you do not want or need this functionality, then set this to false.
|
*/

'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),

/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
|
| Specify the various providers used throughout the package.
|
*/

'providers' => [

    /*
    |--------------------------------------------------------------------------
    | User Provider
    |--------------------------------------------------------------------------
    |
    | Specify the provider that is used to find the user based
    | on the subject claim
    |
    */

    'user' => 'TymonJWTAuthProvidersUserEloquentUserAdapter',

    /*
    |--------------------------------------------------------------------------
    | JWT Provider
    |--------------------------------------------------------------------------
    |
    | Specify the provider that is used to create and decode the tokens.
    |
    */

    'jwt' => 'TymonJWTAuthProvidersJWTNamshiAdapter',

    /*
    |--------------------------------------------------------------------------
    | Authentication Provider
    |--------------------------------------------------------------------------
    |
    | Specify the provider that is used to authenticate users.
    |
    */

    'auth' => 'TymonJWTAuthProvidersAuthIlluminateAuthAdapter',

    /*
    |--------------------------------------------------------------------------
    | Storage Provider
    |--------------------------------------------------------------------------
    |
    | Specify the provider that is used to store tokens in the blacklist
    |
    */

    'storage' => 'TymonJWTAuthProvidersStorageIlluminateCacheAdapter',

],

];

When I try to use JWTAuth::attempt($credentials) it returns error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘mobile’ in
‘where clause’ (SQL: select * from users where mobile =
98123456789 limit 1)

How could I fix this?



from Laravel Questions and Answers https://laravelquestions.com/php/how-to-change-tymon-jwt-authentication-to-use-member-model-instead-of-user-model-in-laravel-5-6/
via Lzo Media

set laravel mail setting to log file - development

set laravel mail setting to log file

I just start to learning laravel and now I have a problem with mail settings.

I want to send reset password email to the log file of the project and for this I change the .env file settings from MAIL_DRIVER = smtp to MAIL_DRIVER = log

I also change the mail.php settings and reset my server because I use (php artisan serve) command.

still i receive following error

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘mytodo.password_resets’ doesn’t exist (SQL: delete from password_resets where email = Ali@gmail.com

I don’t know why it is search for table.

I also see the following question it has same problem but my problem doesn’t solve by their instruction.

Laravel Mail to Log

please help me is there anything else i should try.



from Laravel Questions and Answers https://laravelquestions.com/laravel/set-laravel-mail-setting-to-log-file/
via Lzo Media

How to use Laravel’s 5.6 native Auth functionality with MongoDB - development

How to use Laravel’s 5.6 native Auth functionality with MongoDB

I am using the first-time laravel, and want to use the laravel Auth for login and registration, MongoDB as backend. Using this command enables the laravel Auth

    php artisan make:auth

will it work ? can anyone help me, how to do it..



from Laravel Questions and Answers https://laravelquestions.com/laravel/how-to-use-laravels-5-6-native-auth-functionality-with-mongodb/
via Lzo Media

Link to a specific part of a page - development

Link to a specific part of a page

I have a div that has lots of posts which is created dynamically from the database. The div has input for comment facility as well. I have no problems in posting the comments and I do it using a POST method. Then I redirect to the page using return redirect('/'); method. But it links to the beginning to the page which doesn’t create a good impression on the user. The user might be in the middle of the page and when he/she comments he will go to the beginning of the page and will have to scroll down again. Luckily, I have the divs with class equal to the post_id. So, isn’t there any method to go to the post in which the user posted using that class?



from Laravel Questions and Answers https://laravelquestions.com/php/link-to-a-specific-part-of-a-page/
via Lzo Media

View not loading when called from a Controller in Laravel - development

View not loading when called from a Controller in Laravel

I created a controller using artisan in my Laravel application, here’s the code:

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;

class NavigationController extends Controller {

    public function welcome() {
        return view("welcome");
    }

}

When I use a Closure or load the view directly, everything works fine. But, when I load view from inside a controller, it couldn’t find it. Here’s my web.php file’s code:

Route::get('/', function () {
    return view('NavigationController@welcome');
});

The error it shows:
InvalidArgumentException View [NavigationController@welcome] not found.



from Laravel Questions and Answers https://laravelquestions.com/php/view-not-loading-when-called-from-a-controller-in-laravel/
via Lzo Media

Laravel get input data from POST request in a rest api - development

Laravel get input data from POST request in a rest api

i’m trying to get input data which i post them from rest api as an json format, but in laravel i can’t get them on controller and that return empty array of request

my api route:

Route::group(['prefix' => 'v1', 'namespace' => 'Apiv1'], function () {
    $this->post('login', 'ApiController@login');
});

and ApiController:

<?php

namespace AppHttpControllersApiv1;

use AppHttpControllersController;
use IlluminateHttpRequest;
use IlluminateSupportFacadesValidator;

class ApiController extends Controller
{

    public function login(Request $request)
    {
        dd($request->all());
    }
}

output:

[]

ScreenShot

Laravel get input data from POST request in a rest api



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-get-input-data-from-post-request-in-a-rest-api/
via Lzo Media

How to get the time at which the current user logged in in Laravel? - development

How to get the time at which the current user logged in in Laravel?

I’m using Laravel Authentication. How can I get the time at which the current user logged in? I want to calculate the number of seconds that have passed since the current user logged in. If there is a way to achieve it without using Events, it would be great.



from Laravel Questions and Answers https://laravelquestions.com/php/how-to-get-the-time-at-which-the-current-user-logged-in-in-laravel/
via Lzo Media

Project Specific PHP Error Log in Laravel Valet - development

Project Specific PHP Error Log in Laravel Valet

I just wanted to log PHP errors inside laravel project folder using Valet.

For Example – in Apache2 we can add php error log path (in my case my project folder) in virtual host and every time we add error_log($var); that will log errors inside project folder.

is it possible to create PHP Error log in Valet like so ?



from Laravel Questions and Answers https://laravelquestions.com/php/project-specific-php-error-log-in-laravel-valet/
via Lzo Media

Calculate average from array with fmod() - development

Calculate average from array with fmod()

I have a ratings array in which there are list of ratings of particular product from where i want the result to be average rating.

What i want to achieve is if average rating is 4.2 or 4.3 or something in between 4 to 4.5 it should result as 4.5 and if average rating is like 4.6 or 4.7 or something it should result as 5 rating.

I have done below stuff which is resulting 4.5 still if average rating os 4.2 or 4.6.

$product_ratings = Array
                  (
                     [0] => stdClass Object
                     (
                        [id] => 93
                        [product_id] => 5
                        [rating] => 5
                        [user_id] => 154
                     )
                     [1] => stdClass Object
                     (
                        [id] => 93
                        [product_id] => 5
                        [rating] => 5
                        [user_id] => 154
                     )
                     [2] => stdClass Object
                     (
                        [id] => 93
                        [product_id] => 5
                        [rating] => 3.5
                        [user_id] => 154
                     )
                     [3] => stdClass Object
                     (
                        [id] => 93
                        [product_id] => 5
                        [rating] => 5
                        [user_id] => 154
                     )
                     [4] => stdClass Object
                     (
                        [id] => 93
                        [product_id] => 5
                        [rating] => 2.5
                        [user_id] => 154
                     )
                     [5] => stdClass Object
                     (
                        [id] => 93
                        [product_id] => 5
                        [rating] => 4.5
                        [user_id] => 154
                     )
                   )
                $r = 0;
                $rating_total="";
                foreach ($product_ratings as $row) {
                    $rating_total += $row->rating;
                    $r++;
                }
                $average_rating = "";     
                if($rating_total != "" || $rating_total != 0)
                {
                    $average_rating = $rating_total / $r;
                }
                else
                {
                    $average_rating = 0;
                }
                $avg_rating = $average_rating - fmod($average_rating, 0.5);
                echo $avg_rating



from Laravel Questions and Answers https://laravelquestions.com/php/calculate-average-from-array-with-fmod/
via Lzo Media

Friday, May 18, 2018

Laravel 5.6 and reflection not finding class - development

Laravel 5.6 and reflection not finding class

I’m building a package in Laravel 5.6, im very new to building packages so im cutting and copying and learning as I go. so far so good, except i have run into a little issue.

My main package class is in packages/vendor/packagename/src/packagename.php

In that file, it is using a foreach loop to loop over the classes which i have inserted into the config file, so for example, i have a controller in app/Http/Controllers/TestController

// $class in this case equals TestController
foreach ( $allclasses as $class ) {
    $classMethods = [];

    $reflection = new ReflectionClass( $class );
}

When I run the code, i keep getting the following error;

Class TestController does not exist

The original code that i am copying this part from is found here https://github.com/Bulforce/laravel-ext-direct/blob/master/src/Bulforce/ExtDirect/ExtDirect.php at line 133.

I am taking the above code and building it for Laravel 5.6.

My TestController does exist. Im not sure whats going on. Is it trying to look for the controller in the packages/vendor/packagename/src/ directory?

Im really stumpted … Any help would be greatly appreciated.



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-5-6-and-reflection-not-finding-class/
via Lzo Media

Laravel Creating relationship while updating - development

Laravel Creating relationship while updating

I have a library management system with Student and Book model. The structure of the tables are

Students Table

id | roll_no | name | created_at | updated_at

Books Table

book_id | name | author | publication | student_id | created_at | updated_at

Here, boook_id is the primary key

The relation is as follows

In Book Model

public function student()
{
    return $this->belongsTo('AppStudent');
}

In Student Model

public function books()
{
    return $this->hasMany('AppBook');
}

Initially the student_id in books table is null. Whenever a book is to be issued, book number and student roll number is supplied and the student_id field in books table is updated with the id of the student to whom it is being issued.

In the controller, I have the following code

public function postIssue(Request $request)
{
    $this->validate($request, [ 
        'rollno' => 'required|min:7',
        'bookno' => 'required|numeric',
    ]);
    $roll = $request->input('rollno');
    $bookno = $request->input('bookno');

    $student = Student::where('roll_no','=',$roll);
    $book = Book::where('book_id','=',$bookno);
    $book->student_id = $student->id;
    $book->save();

    return view('book.issue')->with('msg','Book Issued');
}

When I run this codes, I get a error saying
"Undefined property: IlluminateDatabaseEloquentBuilder::$id"

What is going wrong?
Is there a better way of doing this?

I am using Laravel 5.6



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-creating-relationship-while-updating/
via Lzo Media

unable to find index for $geoNear query while using Laravel and MongoDB using Moloquent - development

unable to find index for $geoNear query while using Laravel and MongoDB using Moloquent

I am using the Moloquent model with Laravel 5.6. here is my collection record given below:-

{
    "_id" : ObjectId("5afe619dbe0b8d0e5876b16b"),
    "name" : "Central Park",
    "categories" : [ 
        "4d4b7105d754a06376d81259", 
        "4bf58dd8d48988d116941735", 
        "4bf58dd8d48988d119941735", 
        "4d4b7105d754a06376d81259", 
        "4bf58dd8d48988d116941735", 
        "4bf58dd8d48988d119941735", 
        "4d4b7105d754a06374d81259", 
        "4bf58dd8d48988d16d941735"
    ],
    "loc" : {
        "type" : "Point",
        "coordinates" : [ 
            88.4166612820784, 
            22.5835157504658
        ]
    }
}

I am running this query from the Laravel controller.

$users = MongoTest::where('loc', 'near', [
                    '$geometry' => [
                        'type' => 'Point',
                        'coordinates' => [
                            $longitude,
                            $latitude,
                        ],
                    ],
                    '$maxDistance' => 10,
                ])->get();

print_r($users);

I am getting this error:-

error processing query: ns=tkit.testTree: GEONEAR  field=loc maxdist=10 isNearSphere=0
Sort: {}
Proj: {}
 planner returned error: unable to find index for $geoNear query

How can I solve this?



from Laravel Questions and Answers https://laravelquestions.com/php/unable-to-find-index-for-geonear-query-while-using-laravel-and-mongodb-using-moloquent/
via Lzo Media

after filtering a plucked laravel collection, the indexed array change to Associative array - development

after filtering a plucked laravel collection, the indexed array change to Associative array

I have a collection of model eloquent such as user model, i use the pluck method to get the only post_idfrom this collection, this method give me the indexed array of post_id, but when i use filter or unique method for this indexed array the result change to Associative array. i don’t want a assoc array in result. I want just the unique of post_id’s in the indexed array. laravel auto changing my result.

$this->posts->pluck('post_id')->unique('post_id')  

result is :{ "1": 1 , "2": 2 }.

Is this can a bug or I have a mistake in fetching data by methods?



from Laravel Questions and Answers https://laravelquestions.com/laravel/after-filtering-a-plucked-laravel-collection-the-indexed-array-change-to-associative-array/
via Lzo Media

How to implement OCR in website using Laravel - development

How to implement OCR in website using Laravel

I need to implement OCR searching on my website using Laravel. How can I implement this in Laravel? Is this can be done only by open source OCR?

Any suggestion is appreciable.

Thanks



from Laravel Questions and Answers https://laravelquestions.com/php/how-to-implement-ocr-in-website-using-laravel/
via Lzo Media

Check duplication while uploading to database - development

Check duplication while uploading to database

I need to find duplicated details in the existing table while uploading a Excel file that contains some details,i need to find that by phone number and customer name. I am using mattexcel to upload the data into database.

I don’t want to insert that details if it is in there but other details must insert into that table

Controller

public function importExcel(Request $request)
    {
        if ($request->hasFile('import_file')) {
            Excel::load($request->file('import_file')->getRealPath(), function ($reader) {
                foreach ($reader->toArray() as $key => $row) {
                    $data['customername'] = $row['customername'];
                    $data['chassis'] = $row['chassis'];
                    $data['model'] = $row['model'];
                    $data['branchcode'] = $row['branchcode'];
                    $data['delivery'] = $row['delivery'];
                    $data['customerid'] = $row['customerid'];
                    $data['phone'] = $row['phone'];
                    $data['invoicedate'] = $row['invoicedate'];
                    $data['dse'] = $row['dse'];
                    $data['branch'] = $row['branch'];
                    $data['finance'] = $row['finance'];
                    $data['dono'] = $row['dono'];
                    $data['invoice'] = $row['invoice'];
                    $data['zsm'] = $row['zsm'];
                    $data['sm'] = $row['sm'];
                    $data['agm'] = $row['agm'];
                    $data['dsecode'] = $row['dsecode'];
                    $data['address'] = $row['address'];
                    $data['email'] = $row['email'];
                    $data['color'] = $row['color'];
                    $data['extendedwarrenty'] = $row['extendedwarrenty'];
                    $data['autocaddownload'] = $row['autocaddownload'];
                    $data['numberplate'] = $row['numberplate'];
                    $data['mcpstatus'] = $row['mcpstatus'];
                    $data['plandt'] = $row['plandt'];
                    $data['planok'] = $row['planok'];
                    $data['fasttag'] = $row['fasttag'];
//                    $data['settilment_pdf_path'] = $row['settilment_pdf_path'];
                    $data['rcstatus'] = $row['rcstatus'];
                    $branch = Branch::where([['branch_code', $row['branchcode']], ['status', 0]])->first();
                    $registration_id = Registration::orderBy('registration_id', 'desc')->take(1)->get();

                    if (count($registration_id) > 0) {
                        $regid = $registration_id[0]->registration_id;
                        $regid = $regid + 1;

                    } else {
                        $regid = 1;
                    }

                    $register = new Registration();
                    $register->registration_id = $regid;
                    $register->customername = $row['customername'];
                    $register->chassis = $row['chassis'];
                    $register->model = $row['model'];
                    $register->branchcode = $row['branchcode'];
                    $register->delivery = $row['delivery'];
                    $register->customerid = $row['customerid'];
                    $register->phone = $row['phone'];
                    $register->invoicedate = $row['invoicedate'];
                    $register->dse = $row['dse'];
                    $register->branch = $row['branch'];
                    $register->finance = $row['finance'];
                    $register->dono = $row['dono'];
                    $register->invoice = $row['invoice'];
                    $register->zsm = $row['zsm'];
                    $register->sm = $row['sm'];
                    $register->agm = $row['agm'];
                    $register->dsecode = $row['dsecode'];
                    $register->address = $row['address'];
                    $register->email = $row['email'];
                    $register->color = $row['color'];
                    $register->extendedwarrenty = $row['extendedwarrenty'];
                    $register->autocaddownload = $row['autocaddownload'];
                    $register->numberplate = $row['numberplate'];
                    $register->mcpstatus = $row['mcpstatus'];
                    $register->plandt = $row['plandt'];
                    $register->planok = $row['planok'];
                    $register->fasttag = $row['fasttag'];
                    $register->rcstatus = $row['rcstatus'];
                    $register->dealership = $branch->dealership_id;
                    $register->zone = $branch->zone_id;
                    $register->dh = $branch->dh_id;
                    $register->status = '0';
                    $register->created_user_id = Session::get('created_id');
                    $register->save();
                    $regidn = Registration::orderBy('registration_id', 'desc')->get();
                    $regidd = $regidn[0]->registration_id;

                    $ssitrack = new Ssi_track();
                    $ssitrack->registration_id = $regid;
                    $ssitrack->ssi_track_id = $regid;
                    $ssitrack->save();
                    $ssitrackk = Ssi_track::orderBy('ssi_track_id', 'desc')->get();
                    $ssitrackk = $ssitrackk[0]->registration_id;


                }
            });

        }
        return back()->with('success', 'Your File Is Successfully Uploaded To Database!');
    }



from Laravel Questions and Answers https://laravelquestions.com/php/check-duplication-while-uploading-to-database/
via Lzo Media

Composer update is slow - development

Composer update is slow

enter image description here

Whenever I use composer update, some packages are installing they will be installed, but it’s slow.

I and when it comes to this package, it just wont download, when I check my resources monitor, vagrant download speed is only 8 to 10kbps.

I have tried disabling xdebug by going to /etc/php/7.2/.

I have tried adding –prefer-dist still same problem.

What would be the solution for this? Thank you!



from Laravel Questions and Answers https://laravelquestions.com/laravel/composer-update-is-slow/
via Lzo Media

Laravel Image ( Working on store image ) - development

Laravel Image ( Working on store image )

I am working on a laravel store image function. Fortunately it is working. But my problem is when I’m trying to upload atleast 20+ images. It only stores the first 20 images.

My question is, is there any settings that restricts my code to upload 20+ more files ?

Here is my code

public function storeImages($keycode, $projectsID){
    if(!empty($_FILES[$keycode]['name']) && isset($_FILES[$keycode]) && is_array($_FILES[$keycode]['name'])):
        for($i = 0; $i < count($_FILES[$keycode]['name']); $i++):
            $filename = preg_replace("/[^a-z0-9A-Z.]/","_",$_FILES[$keycode]['name'][$i]);
            move_uploaded_file($_FILES[$keycode]['tmp_name'][$i],"uploads/projects/".$filename); //stores original size
            try{
                if(trim($filename) != ""){
                    $img = Image::make("uploads/projects/".$filename); //opens the original sizes
                    $img->resize(200,200); // resize original
                    $img->save('uploads/projects/200x200_'.$filename); // save resize images
                    $new = array();
                    $new['id'] = AppHelperModelHelper::uuid();
                    $new['project_id'] = $projectsID;
                    $new['type'] = "BEFORE";
                    $new['img_name'] = $filename;
                    DB::table("projects_photos")->insert($new);
                }
            }catch(Exception $e){

            }
        endfor;
    endif;
}



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-image-working-on-store-image/
via Lzo Media

Slack notification for Laravel as it should be. Easy, fast, simple and highly testable. - development

Slack notification for Laravel as it should be. Easy, fast, simple and highly testable.

Slack notification for Laravel as it should be. Easy, fast, simple and highly testable. submitted by /u/Salamandra5
[link] [comments]


from Laravel Questions and Answers https://laravelquestions.com/rlaravel/slack-notification-for-laravel-as-it-should-be-easy-fast-simple-and-highly-testable/
via Lzo Media

Loop image in controller - development

Loop image in controller

MY CODE IN CONTROLLER :

 public function image_item_name($inc) 
{
    if(isset($_POST['inc'])) {
        $inc = $_POST['inc'];
        $i = DB::select("SELECT file_name FROM tbl_image_item_name WHERE inc = '$inc';");

        foreach ($i as $a){ 

          echo '<img src="../../">';

        }
    }else {
        echo "Access Denied";
    }

The Problem :
I cannot to loop the image from database, please help me.



from Laravel Questions and Answers https://laravelquestions.com/laravel/loop-image-in-controller/
via Lzo Media