需要帮助关于Laravel Api

I have two web Application that's work in different domaine , The first one is a Laravel web application like this

domaine1.com 

and another web application that's built also with laravel

domaine2.com

and i have on the first application a dashboard like this ( domaine1.com/dashboard) , I want to add from this dashboard for example A books to the the web Application 2 , that's have it own database and tables ...... Please can someone tell me how can i do it ? i'm kind of Newbie on laravel , i think i should Use something like API ? or Something else ?

Create a route in your Application 2 routes.php to get the books for example

Route::get('domaine2.com/books', 'BookController@getBooks');

In your BookController:

 public function getBooks()
    {
        $books = Books::all();    //I assume that Books is your model
        return $books
    }

Now all you have to do is call this in a function in your controller from domaine1.com application to have your books

$books = file_get_contents('http://domaine2.com/books');

To give it a try first and be sure it works try accessing http://domaine2.com/books to see if you get a json with your books.

Yes. You should use API. Although it will not be that easy, because you want to create cross-domain requests.

If data you want to pass is not classified, you can make a public API handler, meaning that everyone will be allowed to access this. This can be for example a get request that return some objects from your database. Let's say you create a route in your domain1.com:

GET domain1.com/api/books that returns json/data

Then if anyone visits http://domain1.com/api/books he will see this response formatted in json. You can utilize it in your domain2.com app using CURL or built in vue.js with axios.

If data you want to provide is classified or you want to make requests other than GET (POST for example) you will have to read about application authorization. Putting in a simple way: you will have to show your domain1.com app that someone who wants to access restricted data is allowed to do it.

By the way, mentioning other response: you should utilize api.php, not web.php in routes. And have in mind that file_get_contents is significantly slower than CURL.