lalitesh

Lead Dev at Noida

Hire Me

Experience

5,150

0 Best Reply Awards

  • Member Since 3 Years Ago
  • 28 Lessons Completed
  • 1 Favorite

24th February, 2018

lalitesh left a reply on Foreign Key Constraint When Your Primary Key Is UUID Type Column • 3 months ago

I had deleted_by_id as nullable in previous migration and it was working.

Here is a error stack:

  Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1005 Can't create table `laravel_026db`.`#sql-5ec_16d` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `users` add constraint `users_deleted_by_id_foreign` foreign key (`deleted_by_id`) references `users` (`id`))

  at D:\xampp\htdocs\minside\v3\vendor\laravel\framework\src\Illuminate\Database\Connection.php: 664
  660:         // If an exception occurs when attempting to run a query, we'll format the error
  661:         // message to include the bindings with SQL, which will make this exception a
  662:         // lot more helpful to the developer instead of just the database's errors.
  663:         catch (Exception $e) {
  664:             throw new QueryException(
  665:                 $query, $this->prepareBindings($bindings), $e
  666:             );
  667:         }
  668:
  669:         return $result;

  Exception trace:

  1   PDOException::("SQLSTATE[HY000]: General error: 1005 Can't create table `laravel_026db`.`#sql-5ec_16d` (errno: 150 "Foreign key constraint is incorrectly formed")")
      D:\xampp\htdocs\minside\v3\vendor\laravel\framework\src\Illuminate\Database\Connection.php : 458

  2   PDOStatement::execute()
      D:\xampp\htdocs\minside\v3\vendor\laravel\framework\src\Illuminate\Database\Connection.php : 458

  Please use the argument -v to see more details.

Please note that the migration does create the users table with all the fields. However it is not able to create the constraint.

lalitesh left a reply on Foreign Key Constraint When Your Primary Key Is UUID Type Column • 3 months ago

@crnkovic I don't think that is the case.

I had the same migration file earlier in Laravel 5.3, only difference being the UUID, earlier the id field was big integer and now the UUID.

lalitesh started a new conversation Foreign Key Constraint When Your Primary Key Is UUID Type Column • 3 months ago

I am trying to use UUID for my next project and have added a column id, which is a UUID type primary key.

I have another field in table that makes an internal reference ( foreign key ) to the id field. When I try to migrate the migration file it gives an obvious error because ( I guess ) mySQL does not allow you to create foreign key constraint on CHAR type column.

Is there any workaround or do I need to use another Auto-increment/ Integer type column.

Code for my migration file is:

$table->uuid('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->softDeletes();
$table->uuid('deleted_by_id')->nullable();
$table->foreign('deleted_by_id')->references('id')->on('users');
$table->rememberToken();
$table->timestamps();
$table->primary('id');

Error that I get:

  Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1005 Can't create table `laravel_026db`.`#sql-5ec_16d` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `users` add constraint `users_deleted_by_id_foreign` foreign key (`deleted_by_id`) references `users` (`id`))

2nd March, 2017

lalitesh started a new conversation Laravel API With Ionic2 • 1 year ago

Trying to integrate APIs built in L5.4 with ionic 2 and struggling to find a solution.

What I want to do:

  • Authenticate the login using Laravel Password service ( OAuth2 )
  • Once authenticated, it would return the access token.
  • Access Token is passed in the header in a GET API call to receive the user details.

I am able to #1 and #2 but got stuck at #3.

Here is my code of login.ts

public login() {
        this.showLoading();
        this.auth.login(this.loginCredentials).subscribe(allowed => {
            if (allowed) {
                setTimeout(() => {
                    this.loading.dismiss();
                    this.nav.setRoot(HelloIonicPage)
                });
            } else {
                this.showError("Access Denied");
            }
        },
        error => {
            this.showError(error);
        });
    }

auth is a service provider, that has login method.

//Function to get access token

public login(credentials) {
    if (credentials.email === null || credentials.password === null) {
        return Observable.throw("Please insert credentials");
    } else {
        return Observable.create(observer => {
            var link = 'http://localhost/aav3/public/oauth/token';
            var vars =  {
                password: "test123",
                username: "[email protected]",
                grant_type: 'password',
                client_id: 2,
                client_secret: 'yqLbamX6Shsh42luASMkcHftIFaIBppmS0oIsPpI',
                scope: ''
            }

            this.http.post(link, vars)
            .map(res => res.json())
            .subscribe(
                data => { this.getUserFromAccessToken(data);
                    console.log(this.currentUser);
                },
                err => this.error = err,
                () => {
                    console.log(this.error);
                }
            );
            
            
        });
    }
}

//Function to get user from the accessToken

getUserFromAccessToken(oAuthData) {
    let headers = new Headers({ 'Content-Type': 'application/json','Accept': 'application/json','Authorization': 'Bearer ' + oAuthData.access_token });
    let options = new RequestOptions({ headers: headers });
        
    let link = 'http://localhost/aav3/public/api/v1/user';

    return this.http.get(link, options)
    .map(res => res.json())
    .subscribe(
        data => this.currentUser = data.user,
        err => this.error = err
    );
}

currentUser and error are defined as properties of the AuthService class.

Both console.log(this.currentUser) and console.log(this.error) returns undefined.

How should I ensure that an error is thrown either in case the access token is not returned or user is not returned from the access token.

13th January, 2017

lalitesh started a new conversation Laravel 5.3 API Authentication With JS Framework • 1 year ago

I am using L5.3 Passport service for my APIs. I understand that I would need to call: oauth/token with grant_type as password

To authenticate the user and return the access token.

In 5.2 and before I used basic auth with JWT to login the user from the mobile app/ JS framework.

Could anyone explain which is more safer, to use the basic auth or passport way of calling the oauth/token with email/password sent as plain text.

9th December, 2016

lalitesh left a reply on Eloquent Is Generating Duplicate Query • 1 year ago

No, I don't.

public function media() {
    return $this->morphMany('App\Models\Media', 'mediable');
}

8th December, 2016

lalitesh started a new conversation Eloquent Is Generating Duplicate Query • 1 year ago

Hello,

My query is below:

$beneficiaries = User::findOrFail($id)->beneficiaries()->with(['media' => function($q) {
            $q->where('is_featured', 1)->select('mediable_id', 'mediable_type', 'name', 'caption')->first();
        }])

Relations:

  • User has many Beneficiaries
  • Beneficiaries have polymorphic relation with Media.

When I check the query output in the debugger, it is:

select * from `v1tbl_users` where `v1tbl_users`.`id` = '25752' and `v1tbl_users`.`deleted_at` is null limit 1
840μs
minside
select `id`, `reg_num`, `name`, `v1tbl_user_beneficiary`.`user_id` as `pivot_user_id`, `v1tbl_user_beneficiary`.`beneficiary_id` as `pivot_beneficiary_id` from `v1tbl_beneficiaries` inner join `v1tbl_user_beneficiary` on `v1tbl_beneficiaries`.`id` = `v1tbl_user_beneficiary`.`beneficiary_id` where `v1tbl_user_beneficiary`.`user_id` = '25752' and `state` <> '2' and `cluster_id` > '0' and `community_id` > '0' and `v1tbl_beneficiaries`.`deleted_at` is null
980μs
minside
select `mediable_id`, `mediable_type`, `name`, `caption` from `v1tbl_media` where `v1tbl_media`.`mediable_id` in ('3781', '2538') and `v1tbl_media`.`mediable_type` = 'App\Models\Beneficiary' and `is_featured` = '1' limit 1
10.09ms
minside
select `mediable_id`, `mediable_type`, `name`, `caption` from `v1tbl_media` where `v1tbl_media`.`mediable_id` in ('3781', '2538') and `v1tbl_media`.`mediable_type` = 'App\Models\Beneficiary' and `is_featured` = '1' limit 1
10.06ms

Is there a way I could optimize the above query, without running the duplicate queries?

2nd August, 2016

lalitesh started a new conversation Schedule Run Not Executing The Commands • 1 year ago

I have just migrated from L5.1 to L5.2 and got into a trouble straightaway with the scheduled commands.

my crontab is:

*   *   *   *   * php /home/xxxxxx/public_html/artisan schedule:run

Code of my app\Console\Kernal is:

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Mail;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
         Commands\ResetAvailability::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('availability:reset')->everyMinute()->after(function () {

            $messageTxt = "availability:reset has successfully ran:\n";

            Mail::raw($messageTxt, function($message)
            {
                $message->from('[email protected], 'Available Angels');
                $message->subject('Availability reset cron job');
                $message->to('[email protected]');
            });

        });
    }
}

Code of my Commands\ResetAvailability.php file is:

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Mail;

class ResetAvailability extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'availability:reset';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Reset the availibility status of a user to NOT Available';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $messageTxt = "In Reset availibility Handle method:\n";

        Mail::raw($messageTxt, function($message)
        {
        $message->from('[email protected]', 'Available Angels');
        $message->subject('Availibility reset notification');
        $message->to('[email protected]');
        });
    }
}

Output: I am getting just one email i.e. after the cron job has run. Code which is in the handle method is not executing.

7th January, 2016

lalitesh left a reply on One Job Is Processed From The Queue Of Two Jobs • 2 years ago

This was the weird issue, probably a bug in the Laravel 5.1 that creates the job table with no primary/ A.I for the 'id' field.

I just needed to change the structure of my jobs table, made 'id' as primary key/ A.I.

lalitesh left a reply on Load Package From Folder • 2 years ago

After adding the following code to your composer, did you update it

 "lstrojny/fxmlrpc": "dev-master"

If not, run

composer update

lalitesh left a reply on Load Package From Folder • 2 years ago

Can you try

composer dump-autoload

lalitesh started a new conversation One Job Is Processed From The Queue Of Two Jobs • 2 years ago

I am adding two jobs to the queue, that should run one minute after another:

$job1 = (new NotifySubscribers($user));
$this->dispatch($job1);

$job2 = (new TweetOnStatusChange($user))->delay(60);
$this->dispatch($job2);

I noticed two entries are added to the database table and when I run the following:

$php artisan queue:work

After few seconds, both the entries are disappeared from the table. However, only first one really works, tweet is not posted.

But, if I use the following code:

$job1 = (new NotifySubscribers($user))->delay(60);
$this->dispatch($job1);

$job2 = (new TweetOnStatusChange($user));
$this->dispatch($job2);

Tweet is posted but notification emails are not sent.

lalitesh left a reply on Load Package From Folder • 2 years ago

@aerojun I just read their guide and they mentioned about the service provider at https://www.buckhill.co.uk/products/odoo-connector/#.Vo6ahBV968o

For L4

php 'Buckhill\Odoo\OdooServiceProvider'

For L5

Buckhill\Odoo\OdooServiceProvider::class

lalitesh left a reply on Load Package From Folder • 2 years ago

You should not include this in the "requite" brackets. Assuming you have uploaded/ copied the package in your vendor directory, open the config/app.php, go to the end of the providers array and add an entry of the package's service provider class, like:

App\Providers\ComposerServiceProvider::class,

You may also need to add an entry in the aliases array, like:

'View'      => Illuminate\Support\Facades\View::class,

lalitesh left a reply on Render All URLs With Https? • 2 years ago

I defined the outermost group as below and had all my routes defined within the group.

Route::group(['https'], function(){
});

You may also consider htaccess to force redirect from http to https.

21st November, 2015

lalitesh left a reply on Idle Session Expiration • 2 years ago

@bobbybouwmann , that is one part i.e. expiration of session if the browser is closed. But what about the auto-expire after the idle time is reached? Why would not it work?

I have tried this solution https://laracasts.com/discuss/channels/laravel/help-is-neededd-on-idle-session-time-out by @joostvanveen but it does not seem to use the Laravel config for idle time setting.

lalitesh started a new conversation Idle Session Expiration • 2 years ago

There is a configuration in Laravel to set the session drive and idle expiration time, that I set to the following:


    'lifetime' => 1,

    'expire_on_close' => true,

Now, I logged into my Laravel application and left the screen idle for more than 1 minute ( actually 7 minutes ) and then refreshed the page, but I am not logged out.

I also re-started the browser but I am still in.

Do I need to code anywhere else for auto-logout?

22nd October, 2015

lalitesh started a new conversation Best Practise In Eloquent To Filter The Results • 2 years ago

Struggling to use a filter on my database to get the desired results, my tables are:

users subscriptions (id, user_id, starts_at, expires_at ) transactions (subscription_id, status ) and some other fields

A user may have multiple subscriptions but only one active at a time.

My query is:

$query = DB::table('users AS u')
        ->leftJoin('locations AS l1', 'u.home_city_id', '=', 'l1.id')
        ->leftJoin('locations AS l2', 'u.visiting_city_id', '=', 'l2.id')
        ->leftJoin('locations AS l3', 'l1.parent_id', '=', 'l3.id')
        ->leftJoin('locations AS l4', 'l2.parent_id', '=', 'l4.id')
        ->leftJoin('user_subscriptions', 'u.id', '=', 'user_subscriptions.user_id')
        ->leftJoin('transactions AS t', 't.subscription_id', '=', 'user_subscriptions.id')
        ->select(DB::raw('IF(DATE(expires_at) >= "'.$now.'", "Active","Inactive") as subscription_status'),DB::raw('DATE(expires_at)'),'u.id','u.username','u.email','u.name','u.status','u.created_at','l1.name as home_city', 'l1.parent_id as home_state_id','l2.name AS visiting_city','l3.short_name AS home_state','l4.short_name AS visiting_state');

and when a search is made, query would be something like:

if($this->request['subscription']==1)
            $query = $query->where(DB::raw('DATE(expires_at)'),'>=', $now)->where('t.status',1);
        elseif($this->request['subscription']==2)
            $query = $query->where(DB::raw('DATE(expires_at)'),'<', $now);
        elseif($this->request['subscription']==3)
            $query = $query->where(DB::raw('DATE(expires_at)'),NULL);

Problems:

  • Since a user may have many subscriptions, I am not able to get only the most recent subscription, I know Eloquent has a method (recent ) to get one but not sure how to this in the above case.
  • Filter would not work.

7th October, 2015

lalitesh left a reply on How To Solve CURL Error 60: SSL Certificate In Laravel 5 While Facebook Authentication • 2 years ago

If someone is still looking for a solution, there is an easy fix:

Go to http://curl.haxx.se/ca/cacert.pem and download the pem file and save in your php installation directory ( make sure while saving it retains the extension and not saved as a text file )

Now, open your php.ini file, scroll to the bottom and add the following line:

[cURL] 
curl.cainfo="D:\xampp\php\cacert.pem"

Replace D:\xampp\php\cacert.pem with the actual path.

6th October, 2015

lalitesh left a reply on Laravel 5 Auth::attemp() Method • 2 years ago

My User model was missing the some class,

Old code

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
-------

New code

namespace App\Models;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract {

    use Authenticatable, CanResetPassword;
    use SoftDeletes;
    ----------

And it worked. I was getting error only when email address was correct and password was wrong.

27th August, 2015

lalitesh left a reply on Extend Sentinel To Filter The User Model Data • 2 years ago

Just a correction in the above query, I repeated orwhere with name, it should be other field.

    if($keywords)
    {
    $users = $users->where(function ($query) {
    $query->orWhere('name', 'like', '%'.$keyword.'%')
    orWhere('name', 'like', '%'.$keyword.'%');
    })

lalitesh started a new conversation Extend Sentinel To Filter The User Model Data • 2 years ago

Using sentinel for L5.1 and stuck at a place where I need to filter the users based on some fields, as well as the role,

I can get a list of users by a role using the following

$roleObj = Sentinel::findRoleBySlug('client');

but what if I would like to get all the users whose role is 'client' and name contains 'ab' string.

I thought of writing my own method in User model, that extends Sentinel's EloquentUser class and would like to get some suggestion on it.

public method getUsersByRole($role=null, $keyword=null)
{
    $users = User::with(['users_roles' => function ($query) use ($role){
    if($role)
        $query->where('slug', $role);
    }]);

    if($keywords)
    {
    $users = $users->where(function ($query) {
    $query->orWhere('name', 'like', '%'.$keyword.'%')
    orWhere('name', 'like', '%'.$keyword.'%');
    })
    return $users->get();
}

If the above is the right approach or I can use any built-in sentinel trait or method for the purpose.

24th February, 2015

lalitesh left a reply on Cartalyst Social Package Error • 3 years ago

Realized I made a silly mistake. It is fixed.

lalitesh started a new conversation Cartalyst Social Package Error • 3 years ago

Trying to implement the social package from Cartalyst, it is all working fine if I put the callback code directly in the route but when I move the code to the controller, I get the following error:

ErrorException in UserController.php line 125:
Argument 1 passed to App\Http\Controllers\UserController::Piconect\Http\Controllers\{closure}() must be an instance of App\Http\Controllers\Cartalyst\Sentinel\Addons\Social\Models\LinkInterface, instance of Cartalyst\Sentinel\Addons\Social\Models\Link given

Route is:

Route::get('oauth/callback/facebook', ['as' => 'social-callback', 'uses' => 'UserController@oAuthCallback']);

Controller code is:

public function oAuthCallback($service=''){  
           $callback = URL::current();
           try {
               $user = Social::authenticate('facebook', $callback, function(Cartalyst\Sentinel\Addons\Social\Models\LinkInterface $link, $provider, $token, $slug)
               {
                  $user = $link->getUser();
                  $data = $provider->getUserDetails($token);
                   //$user->foo = $data->foo;
                   $user->save();
               });
           }
           catch (Cartalyst\Sentinel\Addons\Social\AccessMissingException $e)
           {
               // Missing OAuth parameters were missing from the query string.
               // Either the person rejected the app, or the URL has been manually
               // accesed.
               if ($error = Input::get('error'))
               {
                   return Redirect::to('oauth')->withErrors($error);
               }

               App::abort(404);
           }
       }

19th February, 2015

lalitesh left a reply on Events Listener And Handler • 3 years ago

Thank you @JarekTkaczyk and @nolros again! I I was finally able to make it work with the help of yours suggestion.

lalitesh left a reply on Events Listener And Handler • 3 years ago

Thanks @JarekTkaczyk and @nolros

I thought I was not clear on my question.

I following the instructions on L5 doc to create the event handler. I added the following code in the EventServiceProvider

'App\Events\NewUserSignedUp' => [
                'App\Handlers\Events\NewUserOTP@handle',
                ],
                'App\Events\NewUserRegistered' => [
                'App\Handlers\Events\NewUserActivationEmail@handle',
                ],

After that I ran the following command:

php artisan event:generate

The above command generated the following files for me: App\Events\NewUserOTP.php, App\Events\NewUserSignedup.php, App\Handlers\Events\NewUserActivationEmail@handle.php, App\Handlers\Events\NewUserOTP@handle.php,

Code for one of the handler file is:

<?php namespace App\Handlers\Events;

use App\Events\NewUserRegistered;

use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldBeQueued;

class NewUserActivationEmail@handle {

    /**
     * Create the event handler.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  NewUserRegistered  $event
     * @return void
     */
    public function handle(NewUserRegistered $event)
    {
        //
    }

}

Now back to my original question and confusion - Why handler file name is like that? Is it a bug with the command?

lalitesh left a reply on Events Listener And Handler • 3 years ago

@khoanguyenme Actually I just did few minutes back but no specific mention there about the issue I posted.

lalitesh left a reply on Events Listener And Handler • 3 years ago

Thanks @nolros But did you see the other issue I mentioned.

What if I just want one event handler handling different events?

lalitesh left a reply on How To Display The Picture Uploaded By The User Beside The User's Name In Viewpage • 3 years ago

@dinis they cannot be removed on its down. If you are using a pivot table or other relationship, try using detch method as described at http://laravel.com/docs/4.2/eloquent, Also, in the edit/ update controller action you would need to write the code to delete the image.

See below a code snippet that I had used in a category CRUD

if (Input::get('image_name')) {
            $media = new Asset;
            
            /*delete old image from DB and filesystem */
            foreach($category->assets as $asset){
                $destinationPath = Config::get('syntara::config.category-image-path');      
                $imgPath = public_path().'/'.$destinationPath.'/'.$asset->name;
                
                if(File::exists($imgPath)){
                    File::delete($imgPath);
                }

            }
            $category->assets()->delete($media);
            $media->name = Input::get('image_name');            
            $category->assets()->save($media);
        }

lalitesh left a reply on L5 Blade Not Working • 3 years ago

@scottmf Some editor could save the file with just .blade extension without adding the PHP. You should double check if the files are properly saved as file.blade.php

Also, check your WAMP's php.ini if it has the support for both the short and longs tags ( i.e. <? and <?php )

lalitesh left a reply on How To Display The Picture Uploaded By The User Beside The User's Name In Viewpage • 3 years ago

@dinis This issue could be because of the following reasons:

  • Old image is not deleted from the media table
  • Old image is not deleted from the file server
  • Some kind of cache is playing

lalitesh started a new conversation Events Listener And Handler • 3 years ago

I am following the Laravel 5 events doc ( http://laravel.com/docs/5.0/events ) to create the event handler:

'App\Events\NewUserSignedUp' => [
'App\Handlers\Events\NewUserOTP@handle',
 ],

It created the correct listener file but both the file name and class name for the Handler seems a bit weird ie.

class NewUserOTP@handle {

I would ideally need to create the event subscriber that can handle all related events for a particular entity e.g. User OTP/ SMS User Welcome Email User Newsletter Subscriber

But I don't see a way how to call these methods from my controller file ( I am referring to an example given at http://laravel.com/docs/5.0/events#event-subscribers ). Also how can I create the event subscriber using the artisan CLI

I hope I am making sense.

lalitesh left a reply on How To Display The Picture Uploaded By The User Beside The User's Name In Viewpage • 3 years ago

@dinis, that code was for the view's blade template. Could you share your controller and view code if the issue was not resolved yet.

18th February, 2015

lalitesh left a reply on How To Display The Picture Uploaded By The User Beside The User's Name In Viewpage • 3 years ago

@dinis cannot you simply use if statement

''' @if(isset($user->media) && (!$user->media->image_name) ){ /Show the image/ } else{ /Show the placeholder/ } '''

lalitesh left a reply on Mobile/ Phone Number Validation • 3 years ago

Thanks, did not think about it! Let me try

lalitesh started a new conversation Mobile/ Phone Number Validation • 3 years ago

Is it possible to extend the L5 validation method to validate the mobile/ phone number?

lalitesh left a reply on How To Display The Picture Uploaded By The User Beside The User's Name In Viewpage • 3 years ago

@dinis I would suggest the following:

  • Create a media table to store the images, it can have a polymorphic relation with your user table
  • Store only the image name in the table
  • If you define the relationships correctly, your $user object would have a media object and can be accessed using $user->media
  • To display the image in the frontend or anywhere, you should have a config setting (in your config file array('user_image_path'=> asset('images/users') ) something like that
  • should display the image

You can also use Intervention package and Intervention Image cache package to dynamically cache and resize the image on the fly.

14th February, 2015

lalitesh left a reply on Database Schema Help • 3 years ago

@Lily Belle Thanks! 'Media' reference was just an example and have nothing to do with my schema. I decided to go with two pivot tables for now :)

lalitesh left a reply on Database Schema Help • 3 years ago

Or I should just use two pivot tables?

lalitesh started a new conversation Database Schema Help • 3 years ago

I am creating a marketplace in L5 and a part of the application would be:

  • Categories: Nested Tree
  • Users: User table
  • Jobs: Jobs posted by the users
  • Users Categories: A user could subscribe to one or more categories
  • Jobs Categories: A job could be in one or more categories

Should I just create a Polymorphic many to many relationship to store the user category and job category in a single table rather than using two tables?

Earlier I used Media table with Polymorphic many to many relationship and stored the entity_id, entity_type and media_name.

13th February, 2015

lalitesh left a reply on Should I Create A Package • 3 years ago

Could you help me a bit on creating a package for a validator or repo that can be used for different packages?

lalitesh left a reply on Should I Create A Package • 3 years ago

Thanks @thepsion5! That was quite helpful! To make sure I start with the correct architecture I am planning to build the following packages:

Users Package Jobs Package Portfolios Package

Should I create another Validator or Repository package like you have been doing or I should include these with each of my package?

lalitesh left a reply on Should I Create A Package • 3 years ago

Thanks @bbloom

What is the general practice in creating a fairly large application? Would you create many independent packages?

lalitesh started a new conversation Should I Create A Package • 3 years ago

My first post at laracasts and it could sound a weird questions for many fellow devs. I am developing a marketplace using Laravel 5 ( I have about an year of experience development in L4 ).

My question is whether I should develop the related and required packages or should I just go without it?

Edit Your Profile
Update

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