jeudi 23 février 2017

Suggest me right architecture for Api first Project

developers, I need your suggestions for my next project. I am going to create next project, API first. means the main website will also depend on API for everything. It may be a really big project with lots of modules and highly scalable.

I thought of making restful API with lumen 5.4 (for speed) and frontend with travel. Is it the right decision?

Please give your views. Thanks in advance



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lQLNZb
via IFTTT

Laravel 5.2 Intervention Image Method save does not exist

I am using Intervention Image on Laravel 5.2

here is my function

public function store(Request $request)
    {
        $slider = new Slider();

        if ($request->hasFile('image')) {
            $slider = $request->file('image');
            $filename = time() . '.' . $slider->getClientOriginalExtension();
            Image::make($slider)->resize(1920, 1008)->save(public_path('images/homeSlider/' . $filename));
            $slider->image = $filename;
        }

        $slider->header = $request->header;
        $slider->paragraph = $request->paragraph;
        $slider->save();

        \Session::flash('sliderSuccess', 'Slider has been successfully uploaded');
        return \Redirect::to('admin/slider/create');
    }

BadMethodCallException in Macroable.php line 74: Method save does not exist. in Macroable.php line 74 at UploadedFile->__call('save', array()) in SliderController.php line 35 at UploadedFile->save() in SliderController.php line 35 at SliderController->store(object(Request))



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kT5Bvb
via IFTTT

The package name was not found in the composer.json, make sure there is a name present

"name": "foostart/sample",
"type": "library",
"description": "Create overview sample can intergrate other project",
"keywords": ["package","package"],
"homepage": "http://ift.tt/2lfuLR8",
"license": "MIT",
"authors": [
    {
        "name": "Foostart",
        "email": "nguyenanhhoanld@gmail.com",
        "role": "Developer"
    }
],
"minimum-stability": "stable",
 "require": {
    "php": ">=5.3.0"
},
"autoload": {
    "psr-4": {
        "Sample": "src"
    }
}

When i submit package from GitHub to Packagist.org. I have a problem with "composer.json". How can i fix it?? Thanks. http://ift.tt/2lfuLR8



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lxGL30
via IFTTT

How to insert editable dropdown in Laravel?

I know how to add dropdown in Laravel, but what about editable dropdown?





from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lxvIXC
via IFTTT

Correct way of putting Homestead.yml into VCS

I have a homestead.yml file that looks something like this:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: example.app
name: example
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: "C:/Users/yahya/Documents/example-project"
      to: "/home/vagrant/example"

sites:
    - map: example.app
      to: "/home/vagrant/saroia/public"

databases:
    - homestead

I want to checkout this file in to VCS.

The issue I have is that people will have different values for certain paths. Mainly the folder that is being mapped i.e. C:/Users/yahya/Documents/example-project.

How can I get around this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kSkRbP
via IFTTT

Can I eager/lazy load an attribute in Laravel?

I know I can eager or lazy load a relationship in Laravel. I also know that the relationship objects are basically query objects in disguise, and that calling $user->load('teams') executes that query and adds it to the $user object (even if I don't know how exactly.)

Say I have a User who has gets points from comments. To get the user's points in a database call, I would execute something like this:

SELECT `user_id`, sum(`points`) AS `total_points` FROM `user_comments` where `id` = ?

If I wanted to load them all at once, I would run this query:

SELECT `users`.*, sum(`user_comments`.`points`) AS `total_points`
FROM `users` LEFT JOIN `user_points` ON `users`.`id` = `user_comments`.`user_id`
GROUP BY `users`.`id`

I want to use Laravel to accomplish those tasks. I would like to write something like this

User::where('age', '>', 40)->with('total_points')->get();

and access the value like this

$user->total_points

to load the users and their total scores at the same time. I expect that there might be many, many records and don't want to always call the DB join query each time I have a user. I would also prefer not to load all the comments themselves for each user if I only need their total point value.

Is there a way to use a relationship builder to accomplish this in Laravel?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mcP3ie
via IFTTT

Is there a way to retrieve all embedded models of the same kind?

Let's say there is a User model that embedsMany House models.

public function houses()
    {
        return $this->embedsMany('App\House');
    }

Is there a way to retrieve a list of all houses for all members?

Passing $houses = House:all(); to the view, returns nothing.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lwsUKc
via IFTTT