I currently have 2 different tables(article and cost), controllers, models and routes. I am currently in a view of the cost but I want to access a column from the article database, how do I do so? The page is displaying undefined variable: article error.
Currently in view page of cost table, this results in an error
value="{{ $article->articlecost }}"
Web.php
Route::resource('articles', ArticleController::class);
Route::resource('costs', CostController::class);
CostController
use App\Models\Cost;
use App\Models\Article;
class SalaryController extends Controller
{
public function create()
{
$articles = Article::all();
return view('costs.create');
}
}